How to Track AI Traffic in GA4 and Ahrefs Web Analytics (ChatGPT & More)

Open your GA4 dashboard right now and look at your traffic sources. Chances are, if someone landed on your site after ChatGPT recommended you, that visit is sitting quietly inside “Direct” or “Unsourced/Not set.” You have no idea it happened. Your boss has no idea it happened. And if you’re trying to prove that your AEO work is paying off, you’re stuck showing a graph that doesn’t reflect reality.

This is the single biggest blind spot in AI search measurement right now, and it’s an easy one to fix once you know where to look.

We’ve spent this whole series talking about how to get cited in AI search — from understanding how AI search engines actually work to doing keyword and prompt research for AEO to earning the kind of brand mentions that get you quoted by name. None of that matters if you can’t actually see the traffic it produces. So in this lesson, we’re setting up proper AI traffic tracking in both GA4 and Ahrefs Web Analytics, so you can stop guessing and start measuring.

Why GA4 hides AI traffic in the first place

GA4 wasn’t built with ChatGPT, Perplexity, or Gemini in mind. It classifies traffic using a set of default channel rules written for a world where “referral” meant another website linking to you, and “organic search” meant Google or Bing.

AI assistants break that model in a few specific ways:

  • Some AI platforms pass a clean referrer. When someone clicks a link inside a ChatGPT or Perplexity answer, GA4 usually logs it as a referral from that platform’s domain — but it lumps it in with every other referral, next to random blog links and forum posts. You can’t isolate it without digging.
  • Some AI platforms strip the referrer entirely. Certain in-app browsers and mobile AI clients don’t pass referral data at all. That traffic lands in “Direct,” mixed in with people who typed your URL from memory. There’s no way to separate the two after the fact.
  • App-based assistants add another layer. Traffic from the ChatGPT mobile app or voice assistants can behave differently than a browser session, and GA4’s default channel grouping doesn’t have a category built for any of it.

The result: your AI-driven traffic is real, but it’s invisible unless you go build a way to see it.

Set up a custom AI channel group in GA4

The fix is to build a custom channel that specifically watches for known AI referrer domains, so GA4 stops mixing AI visits in with everything else.

Step 1: Open your channel group settings

In GA4, go to Admin → Data Display → Channel Groups. You’ll see the default channel group GA4 ships with. Don’t edit it directly — click the three-dot menu next to it and choose “Copy to create new.” This keeps your original grouping intact while giving you a new one to customize.

Step 2: Name the group and add a new channel

Call the new group something clear, like “Channel Group with AI.” Inside it, click Add new channel and name it “AI Traffic.”

Step 3: Build the condition

Set the rule to Source → Matches regex, then paste in a pattern that covers the major AI platforms sending traffic today:

.*chatgpt\.com.*|.*chat\.openai\.com.*|.*perplexity\.ai.*|.*gemini\.google\.com.*|.*copilot\.microsoft\.com.*|.*claude\.ai.*|.*deepseek\.com.*|.*bing\.com\/chat.*|.*you\.com.*|.*poe\.com.*

This isn’t a “set it once and forget it” list. New AI products launch constantly, and naming conventions shift (Gemini used to route through bard.google.com, for example). Revisit this regex every few months and add whatever’s new.

Step 4: Save, then check your report

Head to Reports → Acquisition → Traffic Acquisition, and switch the channel dimension at the top of the table to your new “Channel Group with AI.” You’ll now see AI Traffic sitting as its own line item, separate from generic referral and direct traffic.

Keep your expectations realistic here. For most sites today, AI referral traffic is still a small slice of total sessions — often well under 1%. That doesn’t mean it’s not worth tracking. It means you’re catching a new channel early, while almost nobody else bothers to measure it properly.

Go deeper: track individual AI sources over time

Once the top-level channel is working, you’ll want to know which AI platform is actually sending you visitors — ChatGPT and Perplexity behave very differently as traffic sources, and lumping them together hides that.

  • Go to the Explore tab in GA4 and start a new blank exploration.
  • Click the + next to Segments, choose “Create new segment,” then “Session segment.”
  • Set the condition to Session source → Matches regex, and paste the same AI regex pattern you used for the channel group.
  • Name it “AI Traffic Sources” and apply it.

With that segment built, set your exploration up as a line chart: dimension = Session source/medium, metric = Sessions, breakdown = Session source/medium, and pick a daily or weekly granularity. Now you’ve got a trended view showing exactly which AI platforms are sending visits, and how that mix shifts week to week. It’s common to see the leading source flip over a few months as one assistant’s citation behavior changes — you won’t catch that shift at all if you’re only watching a single blended number.

Why Ahrefs Web Analytics makes this easier

Building the GA4 setup above is worth doing because GA4 is probably already installed on your site and it’s free. But if you want AI traffic tracking without the manual regex work, Ahrefs Web Analytics has it built in from day one.

A few practical differences worth knowing:

  • It ships with an AI/LLM channel already configured. No regex, no custom segments — open the dashboard and filter by the “LLM” channel.
  • It separates “Unknown” from “Direct.” This matters more than it sounds. GA4 quietly folds referrer-stripped AI visits into Direct, inflating that number and hiding the AI signal inside it. Ahrefs keeps genuinely unattributable traffic in its own bucket instead of pretending it’s all people typing your URL from memory.
  • Data shows up in close to real time, instead of the 24–48 hour delay GA4 is known for. If you just published something and want to see whether an AI platform is already citing it, that speed matters.
  • The tracking script is lightweight — a small fraction of the size of a typical Google Tag Manager container, so it doesn’t drag down page speed the way an ever-growing GTM setup can.

To use it, add the Ahrefs Web Analytics snippet to your site (one line of code, same as any analytics tag), and the AI channel starts populating automatically. No configuration required.

What to actually do with this data

Tracking AI traffic isn’t the finish line — it’s the input for a handful of decisions you can now make with actual numbers instead of guesses.

  • Benchmark AI against your other channels. Look at your Overview report with the LLM/AI filter applied, and compare it against organic search, social, and referral. If AI traffic is small but climbing month over month, it’s a signal to invest more.
  • Find your top AI sources. Filter down to see whether ChatGPT, Perplexity, Gemini, or Copilot is doing the heavy lifting, and focus your structural and content work on what that platform tends to reward.
  • Find your top AI content. Pull the Pages report filtered to AI traffic and see which URLs are actually getting surfaced — then produce more of what’s already working.
  • Watch how fast new content gets picked up. With near-real-time reporting, you can watch the clock after publishing and see how many hours pass before the first AI-driven visit shows up.
  • Check the audience behind the traffic. Geography, device, and browser breakdowns for your AI segment can flag localization opportunities you weren’t otherwise tracking.

The mistake most people make here

The most common mistake isn’t getting the regex wrong — it’s waiting to set any of this up until “AI traffic actually matters.” By the time it’s obviously significant, you’ll have months of history sitting uncategorized in Direct and Referral, with no way to go back and separate it out retroactively. Set up the channel group or the Ahrefs Web Analytics snippet now, while the numbers are small, so you have a clean baseline the moment things pick up.

It’s the same logic behind technical AEO fundamentals like robots.txt and llms.txt: the value isn’t in reacting once something’s already a problem or an opportunity. It’s in having the plumbing in place before you need it.

Wrapping up

AI-referred visitors are already landing on your site — the only question is whether you can see them. A custom channel group in GA4 gets you there for free with about ten minutes of setup. Ahrefs Web Analytics gets you there instantly, with a cleaner split between genuine “Unknown” traffic and AI-driven visits, plus real-time reporting that GA4 can’t match.

Either way, don’t skip this step. Every other part of your AEO strategy — content structure, brand mentions, technical setup — is easier to justify and refine when you can point to real traffic data instead of a hunch.

Continue the AEO Series

References

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top