Skip to content

šŸ“ˆ Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Reduce 'Direct / None' referrers by inferring it from UTMs as a backup

Blue Mousee8d606417fd8
diff --git a/backend/apps/cloud/src/analytics/analytics.controller.ts b/backend/apps/cloud/src/analytics/analytics.controller.ts
index 36152d32e..d63238547 100644
--- a/backend/apps/cloud/src/analytics/analytics.controller.ts
+++ b/backend/apps/cloud/src/analytics/analytics.controller.ts
@@ -91,6 +91,7 @@ import {
performanceTransformer,
trafficTransformer,
} from './utils/transformers'
+import { enrichTrafficSource } from './utils/clickIdSources'
import {
MAX_METRICS_IN_VIEW,
ProjectViewCustomEventDto,
@@ -1583,6 +1584,8 @@ export class AnalyticsController {
profileId,
)
+ enrichTrafficSource(eventsDTO)
+
const transformed = customEventTransformer(
psid,
profileId,
@@ -1723,6 +1726,8 @@ export class AnalyticsController {
const { deviceType, browserName, browserVersion, osName, osVersion } =
await this.analyticsService.getRequestInformation(headers)
+ enrichTrafficSource(logDTO)
+
const transformed = trafficTransformer(
psid,
profileId,
diff --git a/backend/apps/cloud/src/analytics/utils/clickIdSources.ts b/backend/apps/cloud/src/analytics/utils/clickIdSources.ts
new file mode 100644
index 000000000..921ea8d23
--- /dev/null
+++ b/backend/apps/cloud/src/analytics/utils/clickIdSources.ts
@@ -0,0 +1,203 @@
+/**
+ * Click-ID based traffic source enrichment.
+ *
+ * Many ad networks, social apps and email platforms append a unique
+ * tracking parameter (a "click ID") to URLs they send users to. When the
+ * referring app is a native mobile app or in-app browser (Twitter/X,
+ * Reddit, Facebook, TikTok, Gmail iOS, Slack, ...) the HTTP `Referer`
+ * header is almost always stripped — but the click ID is preserved in
+ * the destination URL.
+ *
+ * By detecting these click IDs server-side we can synthesize a sensible
+ * `source` / `medium` (and a canonical `referrer`) for events that would
+ * otherwise be bucketed as "Direct / None".
+ *
+ * Explicit UTM parameters set by the marketer always win — this only
+ * fills in gaps.
+ */
+
+interface ClickIdMapping {
+ /** Canonical traffic source (utm_source). */
+ source: string
+ /** Canonical traffic medium (utm_medium). */
+ medium: string
+ /** Canonical referrer URL used when `ref` is empty. */
+ ref: string
+}
+
+/**
+ * Click-ID parameter -> inferred traffic source mapping.
+ * Keys are lowercase, matching is case-insensitive.
+ *
+ * Order matters: ad-network click IDs (paid) are listed before
+ * social/email ones so that the most specific attribution wins when
+ * multiple click IDs are present in the same URL.
+ */
+const CLICK_ID_MAP: Record<string, ClickIdMapping> = {
+ // Google Ads
+ gclid: { source: 'google', medium: 'cpc', ref: 'https://google.com' },
+ gbraid: { source: 'google', medium: 'cpc', ref: 'https://google.com' },
+ wbraid: { source: 'google', medium: 'cpc', ref: 'https://google.com' },
+ dclid: {
+ source: 'google',
+ medium: 'display',
+ ref: 'https://google.com',
+ },
+ // Microsoft / Bing Ads
+ msclkid: { source: 'bing', medium: 'cpc', ref: 'https://bing.com' },
+ // Yandex Direct
+ yclid: { source: 'yandex', medium: 'cpc', ref: 'https://yandex.com' },
+ // Adobe Search
+ s_kwcid: { source: 'adobe', medium: 'cpc', ref: 'https://adobe.com' },
+ // Meta / Facebook
+ fbclid: {
+ source: 'facebook',
+ medium: 'social',
+ ref: 'https://facebook.com',
+ },
+ // TikTok Ads / organic
+ ttclid: { source: 'tiktok', medium: 'social', ref: 'https://tiktok.com' },
+ // X / Twitter
+ twclid: { source: 'x', medium: 'social', ref: 'https://x.com' },
+ // LinkedIn
+ li_fat_id: {
+ source: 'linkedin',
+ medium: 'social',
+ ref: 'https://linkedin.com',
+ },
+ // Pinterest
+ epik: {
+ source: 'pinterest',
+ medium: 'social',
+ ref: 'https://pinterest.com',
+ },
+ // Reddit Ads
+ rdt_cid: { source: 'reddit', medium: 'social', ref: 'https://reddit.com' },
+ // Instagram (passed by IG in-app browser when sharing links)
+ igshid: {
+ source: 'instagram',
+ medium: 'social',
+ ref: 'https://instagram.com',
+ },
+ // Snapchat Ads
+ scclid: {
+ source: 'snapchat',
+ medium: 'social',
+ ref: 'https://snapchat.com',
+ },
+ // Mailchimp
+ mc_cid: {
+ source: 'mailchimp',
+ medium: 'email',
+ ref: 'https://mailchimp.com',
+ },
+ mc_eid: {
+ source: 'mailchimp',
+ medium: 'email',
+ ref: 'https://mailchimp.com',
+ },
+ // HubSpot
+ _hsenc: { source: 'hubspot', medium: 'email', ref: 'https://hubspot.com' },
+ _hsmi: { source: 'hubspot', medium: 'email', ref: 'https://hubspot.com' },
+ // Affiliate networks
+ irclid: { source: 'impact', medium: 'affiliate', ref: 'https://impact.com' },
+ sscid: {
+ source: 'shareasale',
+ medium: 'affiliate',
+ ref: 'https://shareasale.com',
+ },
+}
+
+/**
+ * Iteration order is deterministic in modern engines (insertion order),
+ * which gives ad-network IDs priority over social/email — matching the
+ * `CLICK_ID_MAP` declaration above.
+ */
+const CLICK_ID_KEYS = Object.keys(CLICK_ID_MAP)
+
+/**
+ * Placeholder value the JS tracker historically sent in the `me` field
+ * when only a `gclid` was detected on the client. We rewrite it here.
+ */
+const LEGACY_GCLID_PLACEHOLDER = '<gclid>'
+
+/**
+ * Pulls the URL search string out of a `pg` value the tracker sent.
+ *
+ * The tracker only includes the search part when the user enables
+ * `search: true` in `trackPageViews`. When it is included the value
+ * looks like `/path?foo=bar&fbclid=abc` (or `/path#hash?foo=bar`).
+ */
+const extractSearchString = (pg: string | null | undefined): string => {
+ if (!pg) return ''
+ const qIdx = pg.indexOf('?')
+ if (qIdx === -1) return ''
+ let search = pg.slice(qIdx + 1)
+ // Strip a trailing hash fragment if present (`?a=b#hash`)
+ const hashIdx = search.indexOf('#')
+ if (hashIdx !== -1) search = search.slice(0, hashIdx)
+ return search
+}
+
+/**
+ * Returns the first click-ID mapping found in the given query string,
+ * iterating in `CLICK_ID_MAP` priority order so that paid-search IDs
+ * win over social ones.
+ */
+const findClickIdMapping = (search: string): ClickIdMapping | null => {
+ if (!search) return null
+
+ // Lowercase a single time for case-insensitive `key=` matching.
+ // We don't decode the value (we only care about the presence).
+ const lower = `&${search.toLowerCase()}`
+
+ for (const key of CLICK_ID_KEYS) {
+ if (lower.includes(`&${key}=`)) {
+ return CLICK_ID_MAP[key]
+ }
+ }
+ return null
+}
+
+interface TrafficSourceFields {
+ ref?: string | null
+ so?: string | null
+ me?: string | null
+ ca?: string | null
+ te?: string | null
+ co?: string | null
+ pg?: string | null
+}
+
+/**
+ * Enriches an incoming pageview / custom-event payload with traffic
+ * source information derived from click IDs found in the URL.
+ *
+ * Mutates the passed object (and returns it) for ergonomic call-site
+ * usage. UTM parameters explicitly set by the marketer always win — we
+ * only fill empty fields.
+ */
+export const enrichTrafficSource = <T extends TrafficSourceFields>(
+ payload: T,
+): T => {
+ if (!payload) return payload
+
+ // 1. Rewrite the legacy `<gclid>` placeholder the JS tracker emits.
+ if (payload.me === LEGACY_GCLID_PLACEHOLDER) {
+ const gclidMapping = CLICK_ID_MAP.gclid
+ payload.me = gclidMapping.medium
+ if (!payload.so) payload.so = gclidMapping.source
+ if (!payload.ref) payload.ref = gclidMapping.ref
+ }
+
+ // 2. Parse the page URL search string for any known click IDs.
+ const search = extractSearchString(payload.pg)
+ const mapping = findClickIdMapping(search)
+ if (mapping) {
+ if (!payload.so) payload.so = mapping.source
+ if (!payload.me) payload.me = mapping.medium
+ if (!payload.ref) payload.ref = mapping.ref
+ }
+
+ return payload
+}
diff --git a/backend/apps/community/src/analytics/analytics.controller.ts b/backend/apps/community/src/analytics/analytics.controller.ts
index 68f47cbc2..5a04d75ac 100644
--- a/backend/apps/community/src/analytics/analytics.controller.ts
+++ b/backend/apps/community/src/analytics/analytics.controller.ts
@@ -82,6 +82,7 @@ import {
performanceTransformer,
trafficTransformer,
} from './utils/transformers'
+import { enrichTrafficSource } from './utils/clickIdSources'
import { MAX_METRICS_IN_VIEW } from '../project/dto/create-project-view.dto'
import { GetOverallStatsDto } from './dto/get-overall-stats.dto'
import { GetHeartbeatStatsDto } from './dto/get-heartbeat-stats'
@@ -1131,6 +1132,8 @@ export class AnalyticsController {
profileId,
)
+ enrichTrafficSource(eventsDTO)
+
const transformed = customEventTransformer(
psid,
profileId,
@@ -1270,6 +1273,8 @@ export class AnalyticsController {
const { deviceType, browserName, browserVersion, osName, osVersion } =
await this.analyticsService.getRequestInformation(headers)
+ enrichTrafficSource(logDTO)
+
const transformed = trafficTransformer(
psid,
profileId,
diff --git a/backend/apps/community/src/analytics/utils/clickIdSources.ts b/backend/apps/community/src/analytics/utils/clickIdSources.ts
new file mode 100644
index 000000000..921ea8d23
--- /dev/null
+++ b/backend/apps/community/src/analytics/utils/clickIdSources.ts
@@ -0,0 +1,203 @@
+/**
+ * Click-ID based traffic source enrichment.
+ *
+ * Many ad networks, social apps and email platforms append a unique
+ * tracking parameter (a "click ID") to URLs they send users to. When the
+ * referring app is a native mobile app or in-app browser (Twitter/X,
+ * Reddit, Facebook, TikTok, Gmail iOS, Slack, ...) the HTTP `Referer`
+ * header is almost always stripped — but the click ID is preserved in
+ * the destination URL.
+ *
+ * By detecting these click IDs server-side we can synthesize a sensible
+ * `source` / `medium` (and a canonical `referrer`) for events that would
+ * otherwise be bucketed as "Direct / None".
+ *
+ * Explicit UTM parameters set by the marketer always win — this only
+ * fills in gaps.
+ */
+
+interface ClickIdMapping {
+ /** Canonical traffic source (utm_source). */
+ source: string
+ /** Canonical traffic medium (utm_medium). */
+ medium: string
+ /** Canonical referrer URL used when `ref` is empty. */
+ ref: string
+}
+
+/**
+ * Click-ID parameter -> inferred traffic source mapping.
+ * Keys are lowercase, matching is case-insensitive.
+ *
+ * Order matters: ad-network click IDs (paid) are listed before
+ * social/email ones so that the most specific attribution wins when
+ * multiple click IDs are present in the same URL.
+ */
+const CLICK_ID_MAP: Record<string, ClickIdMapping> = {
+ // Google Ads
+ gclid: { source: 'google', medium: 'cpc', ref: 'https://google.com' },
+ gbraid: { source: 'google', medium: 'cpc', ref: 'https://google.com' },
+ wbraid: { source: 'google', medium: 'cpc', ref: 'https://google.com' },
+ dclid: {
+ source: 'google',
+ medium: 'display',
+ ref: 'https://google.com',
+ },
+ // Microsoft / Bing Ads
+ msclkid: { source: 'bing', medium: 'cpc', ref: 'https://bing.com' },
+ // Yandex Direct
+ yclid: { source: 'yandex', medium: 'cpc', ref: 'https://yandex.com' },
+ // Adobe Search
+ s_kwcid: { source: 'adobe', medium: 'cpc', ref: 'https://adobe.com' },
+ // Meta / Facebook
+ fbclid: {
+ source: 'facebook',
+ medium: 'social',
+ ref: 'https://facebook.com',
+ },
+ // TikTok Ads / organic
+ ttclid: { source: 'tiktok', medium: 'social', ref: 'https://tiktok.com' },
+ // X / Twitter
+ twclid: { source: 'x', medium: 'social', ref: 'https://x.com' },
+ // LinkedIn
+ li_fat_id: {
+ source: 'linkedin',
+ medium: 'social',
+ ref: 'https://linkedin.com',
+ },
+ // Pinterest
+ epik: {
+ source: 'pinterest',
+ medium: 'social',
+ ref: 'https://pinterest.com',
+ },
+ // Reddit Ads
+ rdt_cid: { source: 'reddit', medium: 'social', ref: 'https://reddit.com' },
+ // Instagram (passed by IG in-app browser when sharing links)
+ igshid: {
+ source: 'instagram',
+ medium: 'social',
+ ref: 'https://instagram.com',
+ },
+ // Snapchat Ads
+ scclid: {
+ source: 'snapchat',
+ medium: 'social',
+ ref: 'https://snapchat.com',
+ },
+ // Mailchimp
+ mc_cid: {
+ source: 'mailchimp',
+ medium: 'email',
+ ref: 'https://mailchimp.com',
+ },
+ mc_eid: {
+ source: 'mailchimp',
+ medium: 'email',
+ ref: 'https://mailchimp.com',
+ },
+ // HubSpot
+ _hsenc: { source: 'hubspot', medium: 'email', ref: 'https://hubspot.com' },
+ _hsmi: { source: 'hubspot', medium: 'email', ref: 'https://hubspot.com' },
+ // Affiliate networks
+ irclid: { source: 'impact', medium: 'affiliate', ref: 'https://impact.com' },
+ sscid: {
+ source: 'shareasale',
+ medium: 'affiliate',
+ ref: 'https://shareasale.com',
+ },
+}
+
+/**
+ * Iteration order is deterministic in modern engines (insertion order),
+ * which gives ad-network IDs priority over social/email — matching the
+ * `CLICK_ID_MAP` declaration above.
+ */
+const CLICK_ID_KEYS = Object.keys(CLICK_ID_MAP)
+
+/**
+ * Placeholder value the JS tracker historically sent in the `me` field
+ * when only a `gclid` was detected on the client. We rewrite it here.
+ */
+const LEGACY_GCLID_PLACEHOLDER = '<gclid>'
+
+/**
+ * Pulls the URL search string out of a `pg` value the tracker sent.
+ *
+ * The tracker only includes the search part when the user enables
+ * `search: true` in `trackPageViews`. When it is included the value
+ * looks like `/path?foo=bar&fbclid=abc` (or `/path#hash?foo=bar`).
+ */
+const extractSearchString = (pg: string | null | undefined): string => {
+ if (!pg) return ''
+ const qIdx = pg.indexOf('?')
+ if (qIdx === -1) return ''
+ let search = pg.slice(qIdx + 1)
+ // Strip a trailing hash fragment if present (`?a=b#hash`)
+ const hashIdx = search.indexOf('#')
+ if (hashIdx !== -1) search = search.slice(0, hashIdx)
+ return search
+}
+
+/**
+ * Returns the first click-ID mapping found in the given query string,
+ * iterating in `CLICK_ID_MAP` priority order so that paid-search IDs
+ * win over social ones.
+ */
+const findClickIdMapping = (search: string): ClickIdMapping | null => {
+ if (!search) return null
+
+ // Lowercase a single time for case-insensitive `key=` matching.
+ // We don't decode the value (we only care about the presence).
+ const lower = `&${search.toLowerCase()}`
+
+ for (const key of CLICK_ID_KEYS) {
+ if (lower.includes(`&${key}=`)) {
+ return CLICK_ID_MAP[key]
+ }
+ }
+ return null
+}
+
+interface TrafficSourceFields {
+ ref?: string | null
+ so?: string | null
+ me?: string | null
+ ca?: string | null
+ te?: string | null
+ co?: string | null
+ pg?: string | null
+}
+
+/**
+ * Enriches an incoming pageview / custom-event payload with traffic
+ * source information derived from click IDs found in the URL.
+ *
+ * Mutates the passed object (and returns it) for ergonomic call-site
+ * usage. UTM parameters explicitly set by the marketer always win — we
+ * only fill empty fields.
+ */
+export const enrichTrafficSource = <T extends TrafficSourceFields>(
+ payload: T,
+): T => {
+ if (!payload) return payload
+
+ // 1. Rewrite the legacy `<gclid>` placeholder the JS tracker emits.
+ if (payload.me === LEGACY_GCLID_PLACEHOLDER) {
+ const gclidMapping = CLICK_ID_MAP.gclid
+ payload.me = gclidMapping.medium
+ if (!payload.so) payload.so = gclidMapping.source
+ if (!payload.ref) payload.ref = gclidMapping.ref
+ }
+
+ // 2. Parse the page URL search string for any known click IDs.
+ const search = extractSearchString(payload.pg)
+ const mapping = findClickIdMapping(search)
+ if (mapping) {
+ if (!payload.so) payload.so = mapping.source
+ if (!payload.me) payload.me = mapping.medium
+ if (!payload.ref) payload.ref = mapping.ref
+ }
+
+ return payload
+}
diff --git a/docs/content/docs/meta.json b/docs/content/docs/meta.json
index 039242a12..cf5432e92 100644
--- a/docs/content/docs/meta.json
+++ b/docs/content/docs/meta.json
@@ -6,6 +6,7 @@
"add-script",
"script-reference",
"error-tracking",
+ "traffic-sources",
"troubleshooting",
"---Integrations---",
"integration-guides",
diff --git a/docs/content/docs/traffic-sources.mdx b/docs/content/docs/traffic-sources.mdx
new file mode 100644
index 000000000..d501274f7
--- /dev/null
+++ b/docs/content/docs/traffic-sources.mdx
@@ -0,0 +1,184 @@
+---
+title: Traffic sources & reducing "Direct / None"
+slug: /traffic-sources
+icon: Compass
+---
+
+A common question we get is:
+
+> Why is so much of my traffic showing up as **Direct / None**? Are visitors really typing my URL into the address bar?
+
+Almost certainly not. "Direct / None" is a catch-all bucket for any visit that arrived **without a recognisable referrer or campaign tag**. A non‑zero amount of it is unavoidable — but on most sites a meaningful share of it is recoverable.
+
+This page explains where Direct/None comes from, what Swetrix already does for you automatically, and how you can configure your site and campaigns to attribute more traffic correctly.
+
+## Where "Direct / None" actually comes from
+
+A pageview is bucketed as Direct/None when **all** of the following are true:
+
+- The browser sent no `Referer` header (so `document.referrer` is empty), and
+- The URL had no `utm_*` parameters, and
+- The URL had no recognised ad/social click ID (Swetrix detects these — see below).
+
+In practice, the empty‑referrer case happens far more often than people expect:
+
+<Accordions>
+ <Accordion title="In-app browsers (the biggest cause)">
+ When a user taps a link inside the **X / Twitter, Reddit, Facebook,
+ Instagram, TikTok, LinkedIn, Slack, Discord, WhatsApp, Telegram,
+ Signal, Gmail iOS, Outlook iOS, or Notion** mobile apps, the link
+ usually opens in the app's embedded WebView or the system browser
+ via a deep link. Both routes typically **drop the HTTP `Referer`
+ header entirely**.
+
+ There is nothing your site can do about this — but ad/social click
+ IDs (e.g. `fbclid`, `ttclid`) usually survive, which is why they're
+ so important. Swetrix uses them to recover the source automatically.
+
+ </Accordion>
+ <Accordion title="HTTPS to HTTP downgrades">
+ If a user clicks a link **from an HTTPS page to an HTTP page**, all
+ modern browsers strip the referrer. The fix is to serve your whole
+ site over HTTPS (you should be doing this anyway).
+ </Accordion>
+ <Accordion title="Strict referrer policies on the source site">
+ If the referring page sets `Referrer-Policy: no-referrer` or
+ `Referrer-Policy: same-origin` (via response header or
+ `<meta name="referrer">`), no referrer is sent. You can't control
+ other sites' policies, but you should make sure **your own** site
+ doesn't accidentally do this on outbound links.
+ </Accordion>
+ <Accordion title="Privacy browsers and tracking protection">
+ Brave, Firefox in strict mode, Safari with ITP, and Tor all strip
+ or downgrade referrers aggressively for cross‑site navigation. This
+ is a permanent feature of the privacy‑first browser landscape.
+ </Accordion>
+ <Accordion title="Bookmarks, typed URLs, QR codes, document files">
+ Visitors who open your site from a browser bookmark, type the URL
+ in directly, scan a QR code, or click a link in a PDF / Word doc /
+ desktop email client send no referrer. These visits genuinely *are*
+ direct — but you can still tag QR codes and downloadable documents
+ with UTM parameters (see below).
+ </Accordion>
+</Accordions>
+
+## What Swetrix does automatically
+
+You don't need to do anything for these — they're handled in our backend:
+
+- **Browser‑reported referrer.** Whenever the browser sends a `Referer`
+ header (i.e. `document.referrer` is non‑empty), Swetrix uses it as
+ the primary source. The hostname is matched against an extensive
+ built‑in map so that, for example, `https://www.google.com/search?q=…`
+ is grouped under **Google**, `https://duckduckgo.com/` under
+ **DuckDuckGo**, `https://chat.openai.com/` under **ChatGPT**, and so
+ on across hundreds of search engines, AI assistants, social
+ networks, news aggregators, and mail providers. Anything we don't
+ recognise is shown under its raw hostname (e.g. `news.ycombinator.com`).
+- **Click‑ID detection.** When a URL contains a known ad or social click
+ ID (`gclid`, `gbraid`, `wbraid`, `dclid`, `fbclid`, `msclkid`, `ttclid`,
+ `twclid`, `li_fat_id`, `epik`, `rdt_cid`, `igshid`, `scclid`, `yclid`,
+ `mc_cid`, `_hsenc`, `irclid`, `sscid`, and a few more) and no UTM
+ parameters were set, Swetrix synthesizes a sensible source / medium
+ for you. For example, a user landing on `?fbclid=…` from the Facebook
+ app — with no `Referer` header — will be attributed to
+ `facebook / social` instead of `Direct / None`.
+- **In‑app referrer parsing.** Chrome on Android sometimes exposes the
+ source app via referrers like `android-app://com.reddit.frontpage/`.
+ Swetrix recognises these and maps them to the correct source.
+- **UTM parameters always win.** If you set `utm_source` / `utm_medium`
+ / `utm_campaign` on your campaign URLs, those values are used as‑is
+ and override any click‑ID inference.
+
+<Callout type="info">
+ For Swetrix to see click IDs on internal pageviews of single-page apps, enable `search: true` in
+ `trackViews()`. Without it, only the initial landing pageview will include the URL search string.
+ See the [script reference](/swetrix-js-reference#trackviews).
+</Callout>
+
+## What you can do as a site owner
+
+### 1. Tag every campaign with UTM parameters
+
+UTM parameters are the **only** attribution mechanism that survives
+every browser, every privacy mode, every in‑app browser, and every
+referrer policy. If you only do one thing on this list, do this.
+
+A canonical campaign link looks like:
+
+```
+https://example.com/landing
+ ?utm_source=newsletter
+ &utm_medium=email
+ &utm_campaign=spring_sale_2026
+```
+
+Add UTMs to:
+
+- Every newsletter / transactional email link
+- Every social media post (Twitter/X, LinkedIn, Reddit, Bluesky, Mastodon, …)
+- Every ad creative (Google, Meta, TikTok, X Ads, LinkedIn Ads, …)
+- Every QR code (printed materials, packaging, conference booths)
+- Every PDF / whitepaper / slide deck link
+- Every partner / affiliate link
+- Every podcast show‑notes link
+- Every push notification deep link
+
+### 2. Serve your site over HTTPS
+
+If any part of your site is HTTP, links from HTTPS pages to it will
+lose their referrer. There's no good reason to be on HTTP in 2026 —
+[Let's Encrypt](https://letsencrypt.org/) is free, and most hosts
+provide automatic certificate management.
+
+### 3. Don't strip referrers on your own outbound links
+
+If you have a strict `Referrer-Policy` on your site (set via response
+header or `<meta name="referrer">`), other sites you link to won't see
+_you_ as a referrer either. The browser default,
+`strict-origin-when-cross-origin`, is fine — it sends the origin of
+your site (e.g. `https://example.com`) without the path.
+
+Avoid these on outbound links unless you have a specific privacy
+requirement:
+
+- `Referrer-Policy: no-referrer`
+- `Referrer-Policy: same-origin`
+- `<meta name="referrer" content="no-referrer">`
+- `<a rel="noreferrer">` on links you _want_ to be attributed
+
+`<a rel="noopener">` is safe and recommended — it does **not** strip
+the referrer.
+
+### 4. Use the noscript fallback for paranoid blockers
+
+If a non‑trivial share of your visitors uses an aggressive blocker that
+prevents the JS tracker from running, the
+[noscript pixel](/install-script#noscript) still records the pageview —
+but with no referrer, no UTMs, and no click IDs. Make sure to install
+both, not just one or the other.
+
+### 5. Audit your link sharing behaviour
+
+A few sneaky sources of avoidable Direct/None:
+
+- **URL shorteners** sometimes strip the referrer when redirecting.
+ Prefer shorteners that pass through your UTMs (most modern ones do).
+- **Open Graph previews** in messaging apps are pre‑rendered server‑side
+ and don't generate pageviews — but the click that follows comes with
+ no referrer. Append UTMs to the canonical URL the OG preview points to.
+- **Push notifications and webhook redirects** rarely set a referrer.
+ Always include UTMs in the deep‑link URL.
+
+## What's still going to be Direct/None — and why that's okay
+
+Even with everything above set up perfectly, expect a baseline of
+20–40% Direct/None on a typical content site, and higher on
+mobile‑heavy or app‑driven sites. That residual is real direct traffic
+plus the unfixable browser/protocol limitations described at the top
+of this page.
+
+The right way to think about Direct/None is as a **floor**, not a goal
+of zero. The fixable share is what tagging your campaigns recovers —
+and that share is exactly the part you actually care about for
+attribution and ROI reporting.