← / BlogTechnical
ga4chatgpt-trackinggoogle-tag-managerai-traffic-analytics

ChatGPT mention tracking in GA4: the complete setup guide

A step-by-step GA4 and GTM setup for tracking ChatGPT, Gemini, and Claude referral traffic, including the channel priority fix most people get wrong.

By 6 min read

TL;DR

  • GA4 now auto-detects recognized AI assistant traffic (ChatGPT, Gemini, Claude) into a dedicated AI Assistant channel as of May 13, 2026 — no custom rule required for that baseline case.
  • The #1 setup mistake is channel priority order: if Referral sits above your custom AI channel in GA4's channel group rules, AI visits get swallowed by Referral and never show up where you expect.
  • ChatGPT only started appending utm_source=chatgpt.com to desktop citation links in June 2025. Mobile app traffic and older citations still arrive as Direct, so your numbers will always undercount.
  • A GTM Custom JavaScript variable that reads document.referrer lets you fire a custom ai_referral_detected event, which is more flexible than relying on GA4's built-in grouping alone.
  • GA4 cannot split Google AI Overviews from AI Mode clicks — both land in Organic Search. For that distinction you need Search Console's generative AI performance report, not GA4.

ChatGPT mention tracking in GA4 means configuring Google Analytics 4 to isolate, label, and report on sessions that originate from AI assistants citing or linking to your site, as opposed to traditional search or referral traffic. This matters because the default GA4 channel groupings were built for a web where traffic came from search engines, social platforms, and backlinks — not from a chat interface handing a user a clickable citation. Without deliberate setup, AI-sourced sessions get misclassified as Direct or Referral, and you lose the ability to answer the basic question: is ChatGPT sending anyone to my site, and what are they doing when they arrive?

What GA4 does automatically now

As of May 13, 2026, GA4 ships with a built-in AI Assistant channel. When GA4 recognizes the referring domain of a session as belonging to ChatGPT, Gemini, Claude, or another supported assistant, it buckets that session into this channel without any configuration on your part. This is a meaningful change from the prior state, where every AI referral had to be hand-coded into a custom channel group.

The catch is the word "recognized." GA4's recognition depends on referrer data actually being present and matching its internal list. Two gaps remain even with the native channel live:

  • Mobile app traffic. The ChatGPT iOS and Android apps do not pass a standard web referrer, so sessions originating from in-app citation taps still show up as Direct.
  • Pre-June-2025 citation links. ChatGPT only began appending utm_source=chatgpt.com to desktop citation URLs in June 2025. Any link generated by the model before that point, or any link a user copy-pasted without re-querying, carries no UTM and no reliable referrer.

So even with the native channel, expect a persistent undercount. Treat GA4's AI Assistant number as a floor, not a ceiling.

Fixing the channel priority problem

If you're layering a custom channel group on top of (or instead of) the native one — for example, to catch assistants GA4 doesn't yet recognize, or to add your own AI-specific conditions — ordering is everything. GA4 processes channel group rules top to bottom and stops at the first match. If "Referral" is positioned above your custom "AI Traffic" rule, any AI session whose referrer happens to match a generic referral pattern gets claimed by Referral first, and your AI rule never fires, even though it's technically correct.

The fix: in Admin → Data display → Channel groups, open your custom channel group and drag the AI Traffic rule above Referral (and above Organic Search, if your rule also checks against Organic Search domains). Test this with GA4 DebugView against a known AI-referrer URL before trusting the report.

GTM event tracking for AI referrals

Native channel grouping is useful for high-level reporting, but it doesn't give you event-level flexibility — you can't easily build an audience of "people who arrived via Claude in the last 30 days" from channel grouping alone. For that, set up a parallel GTM-based approach:

  1. In Google Tag Manager, create a Custom JavaScript variable that inspects {{Referrer}} and checks it against a list of known AI domains (chat.openai.com, chatgpt.com, perplexity.ai, gemini.google.com, claude.ai). Have it return the matched platform name, or null if nothing matches.
  2. Create a trigger that fires on Page View when that variable is not null.
  3. Create a GA4 Event tag named ai_referral_detected that fires on that trigger and passes the platform name as an event parameter.
  4. In GA4, mark ai_referral_detected as a key event and build an audience or exploration around the platform parameter.

This approach runs independently of GA4's native classification, so it survives changes to Google's recognized-assistant list and lets you segment by platform rather than just a single "AI Assistant" bucket.

Proxying AI Overview clicks (a partial workaround)

GA4 treats clicks from both Google AI Overviews and AI Mode as plain Organic Search — it has no mechanism to tell them apart from a normal blue-link click, and it won't, because Google doesn't expose that distinction in referrer data. You can partially work around this with GTM: fire a custom event whenever a page loads with a text fragment parameter (#:~:text=) in the URL. This scroll-to-text fragment is the signal Google passes when a user clicks through from an AI Overview citation to a specific passage on your page. It's not a perfect proxy — not every AI Overview click carries a fragment, and fragments can originate from other sources too — but it's the closest signal available inside GA4 itself.

For a cleaner read on AI Overview and AI Mode visibility specifically, Search Console's generative AI performance report, launched June 3, 2026, shows impressions inside AI Overviews, AI Mode, and AI-powered Discover features directly, which GA4 cannot. The two tools answer different questions: Search Console tells you where you appeared, GA4 tells you what happened after someone clicked.

Where GA4 setup ends and visibility tracking begins

GA4 and GTM configuration solves one half of the problem: measuring traffic that already arrived. It tells you nothing about whether ChatGPT, Perplexity, Gemini, or Claude are citing you at all for the questions your buyers ask, or who they're citing instead. For that, you need a process that actually queries these assistants on a recurring basis. CiteFlow's free scan runs a 7-dimension audit of how AI assistants crawl and understand your site, with a sample of AI answers showing which URLs get cited. Paid plans track buyer questions weekly across ChatGPT, Perplexity, Gemini, and Claude, plus Google AI Overviews and AI Mode for US English results, showing exactly which sources each answer cites. For a deeper look at building AI traffic segments inside GA4 specifically, see our related guide on how to detect AI traffic in GA4.

FAQ

Does GA4 track ChatGPT traffic automatically now?

Yes, as of May 13, 2026, GA4 groups sessions from recognized AI assistants including ChatGPT, Gemini, and Claude into a dedicated AI Assistant channel without any custom configuration, though mobile app traffic and pre-June-2025 citation links still fall through as Direct.

Why is my custom AI channel rule not matching any sessions?

The most common cause is channel priority order — GA4 evaluates rules top to bottom, and if Referral is listed above your custom AI Traffic rule, matching sessions get claimed by Referral first and never reach your rule.

Can GA4 tell the difference between Google AI Overviews and AI Mode clicks?

No. GA4 classifies both as Organic Search with no way to distinguish them; you can partially proxy AI Overview clicks via a GTM event on the #:~:text= text fragment parameter, but for a reliable split you need Search Console's generative AI performance report.

Sources

Drafted with AI assistance and published by CiteFlow. Sources are linked in the text.

See which AI answers cite your site

CiteFlow is AI search visibility monitoring. The free scan checks how AI assistants read your site and asks Perplexity five buyer questions about your category.