← All posts

Daniel Masajada

How to Track AI Traffic in Google Analytics 4

Läs inlägget på svenska

Some of the visitors to your website now come from AI services such as ChatGPT, Gemini and Perplexity. You can group that traffic into a channel of its own in Google Analytics 4 (GA4) and compare it with your other channels.

Since 13 May 2026 GA4 does part of the job itself. The Default channel group now has an AI Assistant channel and visits get the medium ai-assistant when the referral comes from an AI service that Google recognises. Before that, this traffic usually ended up under Referral, meaning links from other websites. Google's own AI Overviews and AI Mode do not count as AI Assistant.

My recommendation is to create your own channel group for AI traffic anyway. Google does not say that the AI Assistant channel applies to past data, and it does not publish a full list of the services it recognises. According to Google a custom channel group applies retroactively and you decide yourself which AI services count.

The channel group works as a primary or secondary dimension in your reports, meaning as the main breakdown or an extra column. A standard GA4 property can have two custom channel groups in addition to the default group and Analytics 360 can have five.

How to create a channel for AI traffic in Google Analytics 4

The menu names are the same as in the screenshot further down.

  1. Open Admin and click Channel groups under Data display.
  2. Click the three dots in the row for Default channel group and select Copy to create new. This gives you a copy of the default group to start from.
  3. Name the new group, for example Channels with AI.
  4. Click Add new channel and name the channel AI Traffic.
  5. Add a condition where Source matches regex. Paste in this regex (regular expression), which is a pattern that GA4 compares the source with:
    ^(chatgpt\.com|chat\.openai\.com|(www\.)?perplexity\.ai|gemini\.google\.com|claude\.ai|copilot\.microsoft\.com|(www\.)?copilot\.com|chat\.deepseek\.com|(www\.)?meta\.ai|chat\.mistral\.ai|grok\.com)$
  6. Click Save channel.
  7. Click Reorder and drag AI Traffic above Referral. If Google's AI Assistant channel is part of the copy, drag AI Traffic above that too. GA4 puts each visit in the first channel whose conditions it matches. Then click Apply.
  8. Click Save group.
  9. Go to Reports and open Traffic acquisition under Acquisition.
  10. Change the primary dimension of the table to your new channel group. If your website has had visits from AI services, they now show in the AI Traffic row.
  11. Type AI Traffic in the search box above the table and press Enter.
  12. Add Session source / medium as a secondary dimension. You can then see which AI service each visit came from.

The regex lists the addresses of the AI services that send traffic today and ChatGPT's old address chat.openai.com. GA4 requires the whole source to match the pattern. A short pattern such as .*ai therefore catches every website with an address under .ai. Add new addresses when you see more AI services under Referral.

The table will then look roughly like the image below. The image was taken with an older and broader rule, which is why the analytics company heavy.ai also appears. It does not belong in the channel.

The Traffic acquisition report in Google Analytics 4 filtered on the AI Traffic channel, with the sources perplexity.ai, gemini.google.com, chatgpt.com and heavy.ai

The report shows AI traffic alongside the other channels. There you can compare it with traffic from search advertising and Google Shopping, for example. GA4 does not show how often you are mentioned in the answers themselves.

Which AI services may read your website is decided in robots.txt. I go through it in the post on robots.txt and AI crawlers.

Daniel Masajada is the founder of DigitalMassa and has worked with search since 2010.

Want to know where you stand?

The audit shows how you appear in Google and which questions in AI search mention your competitors instead of you. Free for 84 more days. Valued at 15 500 SEK.

Read more

See what we help with →