Skip to content
Surfacedd

Free tool

See your AI assistant traffic in GA4 with one tested regex

Pick the assistants, copy the regex, paste it into a GA4 custom channel. It's built from the same referrer list the Surfacedd app uses, anchored and tested so it doesn't catch unrelated sites.

Runs entirely in your browser. Nothing is sent to Google or to us.
Assistants to include

Matches (ChatGPT). GA4 would put this session in your AI channel.

Session source · matches regex (458 chars)
^([a-z0-9-]+\.)*(chatgpt\.com|chat\.openai\.com|perplexity\.ai|claude\.ai|gemini\.google\.com|bard\.google\.com|copilot\.microsoft\.com|copilot\.cloud\.microsoft|m365\.cloud\.microsoft|grok\.com|meta\.ai|chat\.deepseek\.com|deepseek\.com|chat\.mistral\.ai|you\.com|phind\.com|poe\.com|duck\.ai|kimi\.com|kimi\.moonshot\.cn|chat\.qwen\.ai)$|^(chatgpt|openai|perplexity|claude|anthropic|gemini|bard|copilot|grok|metaai|deepseek|mistral|lechat|phind|kimi|qwen)$
  1. In GA4, open Admin › Data display › Channel groups and click Create new channel group.
  2. Add new channel, name it "AI assistants", and add the condition Source matches regex with the pattern above.
  3. Click Reorder and move "AI assistants" above Referral: GA4 uses the first channel that matches.
  4. Save, then pick the new group in Traffic acquisition. Custom groups apply to past data too.

Short answer

This GA4 regex for AI traffic matches the session sources AI assistants send, such as chatgpt.com, perplexity.ai, claude.ai and gemini.google.com, plus utm_source names like chatgpt. It's anchored for GA4's full-match, case-sensitive regex conditions and generated from Surfacedd's referrer list. Paste it into a custom channel placed above Referral.

How to use it

  1. Pick the assistants. All of them are ticked by default. Untick any you'd rather keep in Referral.
  2. Decide on utm names. Some assistants tag their links with a utm_source such as chatgpt rather than a hostname. Leave "Also match utm_source names" on to count those sessions too.
  3. Copy the regex and follow the four steps under it to create the channel in GA4.
  4. Test a value. Type any session source you see in your reports, such as www.perplexity.ai or news.ycombinator.com, and the tool tells you whether the regex matches it and which assistant it belongs to.

Nothing leaves your browser: the regex is built on this page from a list bundled with it.

How the regex is built

The list comes from ai-referrers.json, the file the Surfacedd app uses to count AI traffic when a GA4 property has no AI Assistant channel. Each assistant has hostnames (chatgpt.com, chat.openai.com) and, for some, utm names (chatgpt, openai). The app's rule is: lowercase the source, drop a leading www., then match when it equals a hostname, ends with . plus a hostname, or equals a utm name.

The tool writes that rule as a regex with two anchored parts:

^([a-z0-9-]+\.)*(chatgpt\.com|chat\.openai\.com|perplexity\.ai|…)$|^(chatgpt|openai|perplexity|…)$

The first part matches a hostname with any subdomains in front of it, so www.perplexity.ai matches but notchatgpt.com and chatgpt.com.example.net don't. The second matches a utm name exactly. A unit test runs the generated regex against a set of real and look-alike source values and checks it agrees with the app's matcher on every one.

Why anchored, and why not Google's example

Google Analytics regex conditions are full match and case sensitive by default (Analytics Help), so the pattern has to describe the whole source value. The tool writes lowercase hostnames, the way they normally appear in the Session source column. Use the test box with values copied from your own report to confirm.

Google's own help page offers an example regex for an AI assistants channel. It's broad on purpose, with patterns such as .*gpt.* and .*gemini.* (Analytics Help), which can sweep in unrelated sources that happen to contain those letters. Ours names each assistant's hosts, so it reaches a little less and misattributes less. Check your own Referral report for a month and add any assistant you see that's missing.

Reading the results in GA4

Once the channel exists, open Reports › Acquisition › Traffic acquisition and switch the primary dimension to your custom channel group. "AI assistants" appears as its own row. Add Session source as a secondary dimension to split it by assistant, and Landing page to see where AI visitors arrive.

Standard GA4 properties allow two custom channel groups with up to 50 channels each, and custom groups can be applied to past data. (Analytics Help) That's the main reason to build one even though GA4's default group now has its own AI Assistant channel: you control the list and you get a like-for-like trend from before that channel existed. The GA4 AI traffic guide compares the two in detail.

Edge cases

  • Order matters. GA4 puts each session in the first channel whose rules match. If "AI assistants" sits below Referral, it stays empty. Move it up.
  • A long pattern. If GA4 refuses the full pattern, tick "Split into patterns of 150 characters or fewer". You get several shorter regexes covering whole assistants, to add as separate conditions joined with OR. Together they match exactly the same sources.
  • Clicks without a referrer. Some app clicks arrive with no referrer and no utm tag. GA4 counts them as Direct, and no regex can recover them.
  • Google's AI features. Clicks from AI Overviews and AI Mode come from google.com and are counted as Organic Search. They aren't AI-assistant referrals in GA4's terms, and this regex doesn't touch them. Search Console is where to look for those.
  • New assistants. We update the referrer list when an assistant changes its domain or a new one appears. Re-generate the regex now and then.

Run it continuously

In Surfacedd, the Search Console and GA4 integration reads your GA4 property with read-only access and shows AI assistant traffic by assistant and landing page on your computer. It uses GA4's AI Assistant channel when your property reports it and this referrer list otherwise, so you can read AI traffic next to how often the same assistants mention you.

Sources

  1. Google Analytics Help: Custom channel groups support.google.com · checked
  2. Google Analytics Help: About regular expressions support.google.com · checked
  3. Google Analytics Help: Default channel group support.google.com · checked

Fair questions

What is the regex for ChatGPT traffic in GA4?

For ChatGPT alone, untick every other assistant: the tool writes ^([a-z0-9-]+\.)*(chatgpt\.com|chat\.openai\.com)$|^(chatgpt|openai)$. It matches chatgpt.com and chat.openai.com with any subdomain, plus the utm names chatgpt and openai. Use it as a "Source matches regex" condition in a custom channel or a report filter.

Doesn't GA4 already have an AI Assistant channel?

Yes. GA4's default channel group now includes an AI Assistant channel for referrers on Google's list. A custom channel still helps when you want assistants Google's list misses, a stricter pattern you control, or a trend that reaches back before the built-in channel existed, since custom groups apply retroactively.

Why doesn't my AI channel show any sessions?

Usually because it sits below Referral in the channel list, so Referral claims those sessions first. Open the channel group, click Reorder and drag "AI assistants" above Referral. Also check the condition uses Source with "matches regex", and test one of your real source values in the box above.

Is the regex case sensitive?

GA4 treats regex conditions as case sensitive by default. Hostnames normally appear in lowercase, which the pattern matches; paste a few real values from your report into the test box to be sure. A utm_source tag typed with capitals, such as ChatGPT, wouldn't match. If your own campaigns use capitals, add those spellings or tag links in lowercase.

Will this catch AI Overviews and AI Mode clicks?

No. Those clicks come from google.com and GA4 counts them as Organic Search, mixed with ordinary search clicks. Neither GA4's AI Assistant channel nor this regex separates them. Search Console's performance data is the place to look for Google's AI features.

How often does the list change?

Whenever an assistant changes its domain or a new one starts sending traffic. The list keeps older domains, such as chat.openai.com, next to current ones. The list is versioned in our code. Regenerate the regex every few months and compare it with what you pasted into GA4.

Run this continuously on your own keys.

Surfacedd checks your robots.txt, crawler logs, schema and AI answers on a schedule, and keeps the history on your computer.

Launch price $29, $79 after 23:59 UTC on January 30, 2027.$79 once. One-time licence. No subscription.