Skip to main content
AI GuidesMeasurement + monitoring

Tracking AI referral traffic in GA4 and more

AI assistants send traffic that default analytics configurations dump into 'Direct' or mislabel as 'Referral'. Setting up correct attribution is a 30-minute project that lets you actually see which engines are driving revenue — and which are still worth zero.

Harry Parker with Evan Mallick

Head of AI Research, Surfient

9 min
answer-bars.svg
Tracking AI referral traffic in GA4 and moreChatGPT75%Perplexity27%Claude26%Gemini43%AI Overviews59%Share of AI Voice

Why default analytics configurations miscategorise AI traffic

GA4, Plausible, and PostHog ship default channel groupings that predate AI assistants. Most AI referrers look like 'Direct' or get lumped into generic Referral.

The analytics platforms merchants use most — GA4, Plausible, PostHog — were all designed before AI assistant traffic existed in meaningful volume. Their default channel groupings recognise Google, Bing, social platforms, email, and standard referrer types; they do not recognise chatgpt.com, perplexity.ai, claude.ai, or any of the other AI domains. The result is that AI traffic ends up in one of three wrong places: Direct (when the AI assistant strips referrer data), Referral > unassigned (when the referrer passes through but no rule matches), or mislabelled as 'AI Other' (in GA4's 2024+ defaults, which recognise some engines but miss others).

73%

of AI assistant traffic is misattributed in default analytics setups

Surfient attribution panel, 312 Shopify stores with default analytics configurations, Q1 2026. Calculated as sessions with an AI-assistant referrer that were categorised as Direct or generic Referral rather than a distinct AI channel.

The miscategorisation matters because channel reporting drives budget decisions. If AI traffic shows up as Direct, it looks like organic brand strength. If it shows up under Referral > unassigned, it gets ignored. Either way, the channel's genuine value is hidden from the people deciding where to invest the next marketing dollar — and it gets hidden in the channel that is growing fastest.

step-flow.svgInfographic
The four-step arc this guide walks through — each numbered card maps to a section below.01default analyticsconfigurationsmiscategorise AI02The referrerpatterns each AIengine actually03GA4 — customchannel groupingfor AI assistants04Plausible —referrer filtersand custom eventsSEQUENCE · STEP 1 → STEP 4
Figure · step flowThe four-step arc this guide walks through — each numbered card maps to a section below.

The referrer patterns each AI engine actually sends

Each engine has its own referrer domain. Some strip referrers by default. Knowing which is which is the foundation of correct attribution.

ChatGPT
Referrer: chatgpt.com (and sometimes chat.openai.com for legacy links). Strips referrer on some deep-link patterns, passes it cleanly on others. Most stores see a mix.
Perplexity
Referrer: perplexity.ai. Consistently sends full referrer including the conversation path (/search/...) which is useful for query-level attribution.
Claude (Anthropic)
Referrer: claude.ai. Passes referrer cleanly. Less common source for shopping traffic but growing.
Google Gemini
Referrer: gemini.google.com. Sends referrer with query path. Distinguish from regular Google Search referrer via path.
Microsoft Copilot
Referrer: copilot.microsoft.com (and sometimes bing.com/chat). Passes referrer reliably.
Google AI Overviews
Referrer: google.com (no distinct path differentiator by default). Hardest to isolate — requires UTM tagging on your side or behavioural heuristics.
You.com
Referrer: you.com. Sends referrer cleanly.
Grok (xAI)
Referrer: grok.com or x.com/i/grok. Referrer behaviour varies by surface (standalone vs X-embedded).

GA4 — custom channel grouping for AI assistants

Create a custom channel group that recognises AI referrer domains. Apply it to all your standard GA4 reports.

GA4's native channel groupings are customisable, and creating an AI Assistants channel is the cleanest way to surface this traffic in reports alongside Organic Search, Direct, and Paid. The setup lives in Admin → Data display → Channel groups → Create channel group.

  1. 1Go to Admin → Data display → Channel groups. Clone the default channel group to preserve it, and create a new one named 'Custom - includes AI'.
  2. 2Add a new channel above Organic Search called 'AI Assistants'. Order matters — this rule should fire before generic Referral rules.
  3. 3Set the definition: Source matches regex ^(chatgpt|perplexity|claude|gemini|copilot|you|grok|chat\.openai|bing)\. OR Source contains 'chatgpt.com' OR 'perplexity.ai' OR 'claude.ai' OR 'gemini.google.com' OR 'copilot.microsoft.com' OR 'you.com' OR 'grok.com'.
  4. 4Save the channel and apply it to your reports via the report customisation panel.
  5. 5Optional but recommended: create per-engine sub-channels ('AI - ChatGPT', 'AI - Perplexity') so you see engine-level breakdowns rather than just the aggregate.
Channel: AI Assistants
Rule: Source matches regex
  ^(chatgpt\.com|perplexity\.ai|claude\.ai|gemini\.google\.com|copilot\.microsoft\.com|you\.com|grok\.com|chat\.openai\.com|bing\.com/chat)
Rule order: Above "Organic Search"

Plausible — referrer filters and custom events

Plausible's approach is simpler but less flexible. Use Sources filtering and custom events to isolate AI traffic.

Plausible is deliberately simpler than GA4 and does not support the same level of custom channel grouping. The practical approach is twofold: use the built-in Sources report with filters to isolate AI referrers, and (for more advanced tracking) fire a custom event on pageview when the referrer matches an AI domain.

Sources report with filter

  1. 1Open the Plausible Sources report for your site.
  2. 2Filter by Source contains 'chatgpt' OR 'perplexity' OR 'claude' OR 'gemini' OR 'copilot' OR 'you.com' OR 'grok'.
  3. 3Save the filtered view as a segment — Plausible supports segment bookmarking so you can return to it easily.

Custom event for AI visits

// Add to your global JS or Shopify theme.liquid <head> via a tag manager
if (document.referrer) {
  const aiDomains = [
    "chatgpt.com",
    "perplexity.ai",
    "claude.ai",
    "gemini.google.com",
    "copilot.microsoft.com",
    "you.com",
    "grok.com",
  ];
  const host = (new URL(document.referrer)).host;
  const match = aiDomains.find((d) => host.endsWith(d));
  if (match) {
    window.plausible("ai_assistant_visit", { props: { engine: match } });
  }
}
  • Custom event fires on any pageview from an AI referrer, tagged with the specific engine.
  • Plausible's Goals / Custom Events view shows the event count broken down by engine.
  • Works alongside the Sources filter approach — the two views answer slightly different questions.

PostHog — property-based attribution and funnels

PostHog supports capturing the referrer as a person property and breaking down reports by it. Cleaner than GA4 for behavioural analysis.

PostHog's strength is event-based analytics and behavioural funnels. For AI attribution, capture the referrer as a property on the initial pageview event, then use property-based breakdowns in any report. The setup is a small addition to your PostHog init script.

posthog.init("YOUR_PROJECT_KEY", {
  api_host: "https://app.posthog.com",
  loaded: (posthog) => {
    if (document.referrer) {
      const aiDomains = {
        "chatgpt.com": "ChatGPT",
        "perplexity.ai": "Perplexity",
        "claude.ai": "Claude",
        "gemini.google.com": "Gemini",
        "copilot.microsoft.com": "Copilot",
        "you.com": "You.com",
        "grok.com": "Grok",
      };
      const host = (new URL(document.referrer)).host;
      const engine = Object.entries(aiDomains).find(([d]) => host.endsWith(d));
      if (engine) {
        posthog.register({
          ai_engine: engine[1],
          source_type: "ai_assistant",
        });
      }
    }
  },
});
  • Every subsequent event in the session carries the ai_engine and source_type properties.
  • Break down any PostHog report (pageviews, conversion funnels, retention) by source_type=ai_assistant to isolate AI-attributed behaviour.
  • Per-engine breakdown by filtering on ai_engine='ChatGPT' (or any other value).
  • Works cleanly with PostHog's revenue events for Shopify — sum of revenue events by ai_engine gives you engine-level revenue attribution.

UTM tagging conventions for controllable AI touchpoints

Where you have control — internal links, newsletter, social — UTM-tag AI-generated content touchpoints so they are unambiguous even if referrers strip.

Referrer-based attribution catches organic AI traffic. For AI touchpoints where you control the link (a ChatGPT custom GPT you published, an AI-generated blog post, a sponsored prompt), UTM tagging gives you unambiguous attribution that does not depend on referrer passing correctly. The convention we use internally:

utm_source
The AI engine or platform — chatgpt, perplexity, claude, gemini, copilot. Lowercase, hyphenated.
utm_medium
ai_assistant for organic AI answers; ai_custom_gpt for a specific GPT you published; ai_sponsored for paid placements in AI surfaces.
utm_campaign
Specific campaign or content group. 'gpt-store-page' for your ChatGPT GPT's profile, 'ai-content-hub' for a specific content push.
utm_content
Optional — the specific link or content variant. Useful for A/B testing different CTAs within the same campaign.

The weekly and monthly reporting cadence that works

Weekly glance at AI channel share and week-over-week delta. Monthly dive into engine-by-engine trends and revenue.

Weekly (10 minutes)
AI Assistants channel share of total sessions, week-over-week delta, any engine that jumped or cratered. Catches fast-moving changes.
Monthly (45 minutes)
Engine-by-engine traffic, conversion rate, revenue contribution, and AOV. Trend across the last 6 months. Informs quarterly budget.
Quarterly (2 hours)
Deep dive. Compare channel growth trajectory against total revenue growth. Revisit channel-group rules for new engines. Adjust GEO investment based on what is working.
The merchants who win the next three years are not the ones who bet the biggest on any single AI channel. They are the ones who measure every channel well, notice which are actually compounding, and reallocate within two quarters.
Harry Parker, Head of AI Research, Surfient

Frequently asked questions

6

Pulled from the questions merchants ask us most often in advisory calls. Crawlers see these as FAQPage schema — the answers here match what appears in AI citations.

  • ChatGPT strips referrer information on some link patterns (notably when users copy a URL out of the chat and paste it elsewhere, or when certain ChatGPT features route through privacy proxies). The fraction varies by ChatGPT version and user interaction pattern — in our panel, roughly 25-40% of ChatGPT-originated sessions arrive with no referrer. The mitigation is UTM tagging on any link you publish to ChatGPT surfaces you control, plus using the Surfient visibility monitor as a leading indicator that corroborates the referrer data.

Free · 5 minutes · no signup

Ready to see your store's GEO score?

Run a free Surfient audit and see exactly what ChatGPT, Perplexity, Claude, Gemini, and Google AI Overviews are missing about your store — signal family by signal family.

0

GEO score

Engine readiness

0

Technical indexing

0

Content fit

0

Live example — your number is ready in about 90 seconds.

Keep reading

Browse all AI Guides