GA4 AI Referral Regex Builder

Build the regex that matches AI-assistant sources in Google Analytics 4, and test it on the values in your own reports.

How to use

What it checks and how it works

The regex is a list of exact host names joined with a vertical bar and with the dots escaped, for example chatgpt\.com|gemini\.google\.com. GA4 matches the whole value by default, so no anchors or wildcards are needed. The list covers chatgpt.com, gemini.google.com, perplexity.ai, claude.ai and the Copilot hosts copilot.microsoft.com and copilot.cloud.microsoft. Microsoft's documentation names copilot.cloud.microsoft as the primary Copilot URL; copilot.microsoft.com is on Zaher's list and was not confirmed on a Microsoft page, so check it in your own Traffic acquisition report. The tool does not match Bing, which is a search engine. The list is Zaher's and it will go out of date. Google's own default AI Assistant channel uses a list that its help page does not publish, so use this regex to build a view you control and add the source values you actually see. Google's pages state a 250-character limit for regexes in report filters; the tool shows the length of yours. The test runs your pattern in the browser's JavaScript engine, while GA4 uses RE2, so confirm in GA4.

Does GA4 already group AI traffic?

Yes. Google's Default channel group page lists an AI Assistant channel for sources such as ChatGPT, Gemini, Copilot and others, and says it excludes Google's AI Overviews and AI Mode. Google does not publish the full list of sources behind it, so a custom regex lets you see exactly the sources you chose.

Where do I paste the regex?

In a report filter, add a filter on Session source with the match type matches regex. In a custom channel group, add a condition on Source with matches regex. The companion tool writes the channel-group steps for you.

Why are some visits from AI assistants missing?

Not every click arrives with a referrer. Some apps and in-app browsers open links without one, so those visits show up as Direct. A regex can only match the sources GA4 receives.

Sources

Related tools

Privacy

Runs in your browser; nothing is uploaded. The interactive tool needs JavaScript.