GA4 AI Traffic Regex Generator
Track visits from ChatGPT, Perplexity, Gemini, Copilot, Claude, and other AI assistants in GA4, and see how much traffic they send you.
- Free
- No sign-up
- Runs in your browser
- Updated
This tool is being built. The guide below already explains how it works.
How to use the GA4 AI Traffic Regex Generator
-
Choose the assistants
All 13 are selected to start. Add any other AI sources you see in GA4.
-
Copy the regex
Pick the GA4 channel group, a report filter, Looker Studio, or BigQuery, and copy the code.
-
Follow the steps
For a channel group, add the AI assistants channel and move it above Referral.
-
Analyze your traffic
Drop in a GA4 export to see AI sessions by assistant, channel, page, and day.
Example: regex for the five main AI assistants
With Main five only selected: ChatGPT, Perplexity, Gemini, Copilot, and Claude.
ChatGPT
Perplexity
Google Gemini
Microsoft Copilot
Claude
^(.*.)?(chatgpt.com|chat.openai.com|perplexity.ai|gemini.google.com|bard.google.com|copilot.microsoft.com|copilot.com|claude.ai)$
The pattern matches chatgpt.com and www.perplexity.ai, but not notchatgpt.com. In a GA4 channel group, also add Medium exactly matches ai-assistant, and move the channel above Referral.
This GA4 AI traffic regex generator builds the regular expression and setup you need to track visits from ChatGPT, Perplexity, Gemini, Copilot, Claude, and eight other AI assistants in Google Analytics. Choose the assistants, then copy a ready-made custom channel group condition, a report or exploration filter, a Looker Studio formula, or a BigQuery query. You can test the regex against your own source values, and drop in a GA4 export to see how much AI referral traffic you get, which assistants send it, and how those visitors behave.
How to use the GA4 AI traffic regex generator
- Choose the AI assistants. All 13 are selected to start. Add any other AI tools you see in your reports under Other sources to include.
- Pick where you’ll use it: a GA4 channel group, a report or exploration filter, Looker Studio, or BigQuery. Each tab has the code and the steps.
- Copy the regex and follow the steps. The tool shows how long the regex is and how many domains it covers.
- Test it by pasting values from GA4’s Session source column. Each one shows whether it matches, and why some AI visits can’t be matched at all.
- Analyze your data on the second tab: drop in a Traffic acquisition export or an exploration to see your AI traffic by assistant, channel, page, and day.

The GA4 AI traffic regex
With every assistant selected, the generated regex is:
^(.*\.)?(chatgpt\.com|chat\.openai\.com|perplexity\.ai|gemini\.google\.com|bard\.google\.com|copilot\.microsoft\.com|copilot\.com|claude\.ai|deepseek\.com|grok\.com|meta\.ai|chat\.mistral\.ai|you\.com|poe\.com|phind\.com|chat\.qwen\.ai)$
Each domain is escaped, so a dot only matches a dot. The ^ and $ make the pattern match the whole source, and (.*\.)? allows subdomains such as www. That matters, because GA4 matches the whole value in some places and only part of it in others. This pattern gives the same result in both, and it ignores look-alike sources such as notchatgpt.com that a simple pattern like chatgpt|perplexity would count.
| Assistant | Sources matched |
|---|---|
| ChatGPT | chatgpt.com, chat.openai.com |
| Perplexity | perplexity.ai |
| Google Gemini | gemini.google.com, bard.google.com |
| Microsoft Copilot | copilot.microsoft.com, copilot.com |
| Claude | claude.ai |
| DeepSeek, Grok, Meta AI | deepseek.com, grok.com, meta.ai |
| Mistral Le Chat, Qwen Chat | chat.mistral.ai, chat.qwen.ai |
| You.com, Poe, Phind | you.com, poe.com, phind.com |
Track AI traffic in GA4 with a custom channel group
A custom channel group is the best way to track AI traffic in GA4, because AI visits then appear as their own channel in every acquisition report, next to Organic Search and Referral. The steps are on the GA4 channel group tab:
- In Admin › Data display › Channel groups, copy the Default Channel Group so you keep GA4’s usual channels.
- Add a channel called AI assistants with the condition Source matches regex and the generated regex.
- Add Or Medium exactly matches ai-assistant, so visits GA4 already recognizes as AI are included.
- Move the channel above Referral. GA4 puts each session in the first channel it matches, so below Referral the AI channel stays empty.
Custom channel groups also apply to past dates, so you can see your AI referral traffic from before you set the group up.
What about the GA4 AI Assistant channel?
In 2026, Google Analytics started grouping some AI visits on its own. As Search Engine Journal reported, when the referrer is an AI assistant Google recognizes, GA4 sets the medium to ai-assistant and counts the session in an AI Assistant channel in the default channel group. Google named ChatGPT, Gemini, and Claude as examples but hasn’t published the full list.
The GA4 AI Assistant channel is useful, but you can’t choose which assistants it includes, and you can’t see which ones it leaves out. A custom channel group with your own regex counts every assistant you choose, and adding the ai-assistant medium as a second condition means you also keep whatever GA4 recognizes. If an export only shows channel names, the analyzer reads the AI Assistant row; for a breakdown by assistant, export Session source / medium instead.
Reports, explorations, Looker Studio, and BigQuery
Not every team wants to change the channel group. The other tabs give you the same regex for other places:
- Reports and explorations. Add a filter or comparison on Session source with matches regex. In an exploration, add Session source, Date, and Landing page to see which pages AI assistants send people to.
- Looker Studio. A calculated field with one
CASEline for each assistant, so you can chart ChatGPT traffic in GA4 data next to Perplexity and Gemini. It uses[.]for dots, so you don’t need to escape anything. - BigQuery. A query that counts sessions by assistant from the GA4 export, using the session’s last-click source from the session_traffic_source_last_click record.
Analyze your AI referral traffic

Open Analyze your AI traffic and add a GA4 export. The easiest is the Traffic acquisition report with Session source / medium as the main dimension, downloaded as CSV. An exploration with Date and Landing page adds a daily chart and a page list. Looker Studio, Sheets, and BigQuery exports work too, and the file is read in your browser, not uploaded.
You get the number and share of sessions from AI assistants, their engagement rate, engagement time, key events, and revenue compared with your site average, and a table for each assistant with the sources it came from. A channel table puts AI traffic next to organic search, direct, referral, social, paid, and email. Rows such as ChatGPT traffic in GA4 recorded as both referral and ai-assistant are combined under ChatGPT.
The analyzer also lists sources whose names suggest an AI tool, such as a new chat assistant, that aren’t on the list yet. Select Count as AI and they’re added to the analysis and to your GA4 AI traffic regex.
What no regex can catch
Every way of measuring AI referral traffic in Google Analytics undercounts it, so treat the numbers as a minimum:
- Visits with no referrer. Many clicks from AI apps, and links people copy from an answer, arrive without a referrer and show up as Direct. ChatGPT adds
utm_source=chatgpt.comto many of its links, which helps, but not every visit has it. - Google’s AI Overviews and AI Mode. Clicks come from Google and count as Organic Search. Google’s guide to AI features and your website says this traffic is included in the Web search type in Search Console.
- Assistants inside other sites. Grok on X and Copilot inside Bing send the same source as the rest of that site.
Even so, tracking the share of sessions from AI assistants month by month shows whether answer engines are sending you more visitors, which pages they cite, and whether those visitors convert. To see which AI crawlers visit your site, use the Search and AI Bot Log Analyzer, and to control them, the AI Crawler robots.txt Generator.
Privacy
GA4 exports show how much traffic your site gets and where it comes from, so the analyzer reads your files in your browser and never uploads them. The regex is built on your device too. Your chosen assistants and extra sources can be saved in your browser if you tick Remember my choices. Nothing else is stored.
GA4 AI Traffic Regex Generator FAQ
How do I track AI traffic in GA4?
Create a custom channel group with a channel whose condition is Source matches regex, using a regex of AI assistant domains, and place it above Referral.
Does GA4 have an AI channel now?
Yes. In 2026 GA4 started putting some AI visits in an AI Assistant channel with the medium ai-assistant, but Google hasn't published which assistants it includes.
Why is some AI traffic missing?
Visits without a referrer, common from AI apps, count as Direct, and clicks from Google's AI Overviews and AI Mode count as Organic Search.
Will the regex work on past data?
Yes. Custom channel groups and report filters apply to past dates as well as new ones.
Which GA4 export can I analyze?
The Traffic acquisition report with Session source / medium as the main dimension, downloaded as CSV, or an exploration with Session source / medium, Date, and Landing page.
Is my data uploaded?
No. The regex is built and your files are read in your browser.
Related tools
Search & AI Bot Log Analyzer
Drop in server access logs to see what Googlebot, Bingbot, GPTBot, and 80+ other bots crawl, catch fake bots, and find crawl waste. Nothing is uploaded.
AI Crawler robots.txt Generator
Block AI training crawlers, AI search bots, or both in robots.txt, keep your existing rules, and test any URL before you upload.
llms.txt Generator
Build an llms.txt file that gives AI agents a curated map of your site, in the format the llms.txt proposal sets out, checked as you type.
Traffic Drop Analyzer
See which pages and queries lost clicks between two periods, and whether lower rankings, fewer searches, a lower click-through rate, or indexing is to blame.
Striking Distance Keyword Finder
Find queries ranking just outside the top results, estimate the extra clicks from your own CTR, and see which page titles are missing them.
Keyword Cannibalization Checker
Find the queries where your own pages compete, see which ones are real problems, and get a clear plan to fix them.