Free tool Track AI referral traffic in GA4 with one regex
People now click through to websites from ChatGPT, Perplexity, Gemini and other assistants. This tool turns the list of AI assistant domains TapCub recognises into a short RE2 pattern for a GA4 custom channel, a report filter or an exploration, explains exactly where to paste it, and lets you test real referrer URLs first.
- 20 AI assistant domains
- RE2 checked, under 250 characters
- Runs locally
Build the regex
The list starts with every AI assistant domain in TapCub's source rules. Remove lines you do not want, add others (one domain per line), and pick where in GA4 you will use the pattern.
One per line. Subdomains are included automatically, so openai.com also covers chat.openai.com. Lines starting with # are ignored.
Paste referrer URLs or hostnames, one per line, to see which assistant they belong to and whether the pattern matches.
^(.*\.)?((claude|mistral|perplexity)\.ai|(chatglm|kimi\.moonshot|metaso)\.cn|(anthropic|bard\.google|chatgpt|copilot\.microsoft|deepseek|doubao|gemini\.google|kimi|openai|phind|poe|tongyi\.aliyun|yiyan\.baidu|you)\.com)$Domains in pattern
20
Characters
220
GA4 report filters accept up to 250.
Checks
- OKValid RE2, 220 of 250 characters.
- Notechat.openai.com is already covered by openai.com.
Where to paste it in GA4
Custom channel group (recommended)
- Open Admin → Data display → Channel groups. You need the Editor role or above.
- Click "Create new channel group", or "Copy to create new" on the default group so the other channels stay as they are.
- Click "Add new channel" and name it AI assistants. Add the condition Source · matches regex · paste the pattern. Click "Save channel".
- Click "Reorder", drag AI assistants above Referral and click "Apply". Traffic goes to the first channel it matches.
- Click "Save group". Custom channel groups also apply to past data in reports.
Report filter
- Open the Traffic acquisition report (Reports → Acquisition).
- Click "+ Add filter" and choose the dimension Session source.
- Set Match Type to matches regex and paste the pattern.
- Click "Apply".
Test results
"TapCub channel" is how TapCub would classify that referrer; "Regex" is whether the pattern above matches the value GA4 would compare.
| Input | Value tested | TapCub channel | Regex |
|---|---|---|---|
https://chatgpt.com/ | chatgpt.com | AI assistant · ChatGPT | Matches |
https://www.perplexity.ai/search/abc | www.perplexity.ai | AI assistant · Perplexity | Matches |
chat.deepseek.com | chat.deepseek.com | AI assistant · DeepSeek | Matches |
https://kimi.moonshot.cn/ | kimi.moonshot.cn | AI assistant · Kimi | Matches |
https://www.google.com/ | www.google.com | Not AI | No match |
https://l.facebook.com/ | l.facebook.com | Not AI | No match |
Share these inputs: the values go after the # in the link, so they never reach a server.
https://tapcub.com/tools/ai-referral-regex
Version v1.0Updated Update history
What you get, and how to use it
The output is one pattern plus the evidence that it does what you expect.
The pattern
Domains are grouped by ending to save characters: (claude|perplexity)\.ai rather than two full entries. ^(.*\.)? allows any subdomain, and the anchors stop look-alikes such as mychatgpt.com or chatgpt.com.example.net from matching.
Session source vs page referrer
Session source is the hostname that started the session and is what channel groups and the Traffic acquisition report use. Page referrer is the full URL before each page view, available in explorations; use it when you also want AI clicks that arrive mid-session.
Full vs partial match
GA4's "matches regex" needs the pattern to cover the whole value, which is why the full form has ^…$. "Matches partial regex" only needs it to appear somewhere. Both forms here give the same result on hostnames.
Test results
Paste referrers from your own reports. A row where TapCub says AI but the regex says no usually means a subdomain or domain you removed from the list, or a value in a different case.
GA4's default channel group now has its own "AI Assistant" channel, assigned when the referrer is on Google's list (Google names ChatGPT, Gemini, DeepSeek, Copilot and Grok as examples but does not publish the full list). A custom channel or filter is still useful to control exactly which assistants count, to include ones Google's list may not cover, such as Kimi or Doubao, and to break traffic down per assistant.
From list to GA4 in four steps
Nothing to install; the pattern updates as you edit.
-
1
Choose the assistants
Keep the full list, use a preset, or paste your own domains. Look at your Session source report for AI domains you already receive.
-
2
Pick the GA4 field
Session source for a custom channel group or report filter; Page referrer for an exploration.
-
3
Test with real referrers
Paste a few referrer URLs from your data. Every AI row should say Matches; Google, Facebook and your own domain should not.
-
4
Paste and reorder
Follow the steps under the pattern. In a channel group, the AI channel must sit above Referral or the traffic stays in Referral.
Which domains count, and how TapCub classifies them
The list is TapCub's own AI source rule set. TapCub checks every visit's referrer against it on arrival: a match puts the visit in the AI channel with the assistant's name, before search and social rules are checked.
- A referrer counts when its hostname, without www., equals, ends with or contains one of the domains
- TapCub applies this automatically; the regex is for reproducing the same grouping in GA4
- Browsers usually send only the origin of the AI site, so per-conversation URLs are not visible to anyone
| Assistant | Domains |
|---|---|
| ChatGPT | chatgpt.com, chat.openai.com, openai.com |
| Claude | claude.ai, anthropic.com |
| Perplexity | perplexity.ai |
| Gemini | gemini.google.com, bard.google.com |
| Copilot | copilot.microsoft.com |
| DeepSeek | deepseek.com |
| Kimi | kimi.com, kimi.moonshot.cn |
| Doubao, ERNIE Bot, Tongyi, ChatGLM, Metaso | doubao.com, yiyan.baidu.com, tongyi.aliyun.com, chatglm.cn, metaso.cn |
| Others | mistral.ai, poe.com, phind.com, you.com |
The default test box, row by row
Six referrers checked against the full-list pattern on Session source with "matches regex".
| Referrer | Value GA4 compares | TapCub channel | Regex |
|---|---|---|---|
https://chatgpt.com/ | chatgpt.com | AI · ChatGPT | Matches |
https://www.perplexity.ai/search/abc | www.perplexity.ai | AI · Perplexity | Matches (subdomain allowed) |
chat.deepseek.com | chat.deepseek.com | AI · DeepSeek | Matches |
https://kimi.moonshot.cn/ | kimi.moonshot.cn | AI · Kimi | Matches |
https://www.google.com/ | www.google.com | Not AI (search) | No match |
https://l.facebook.com/ | l.facebook.com | Not AI (social) | No match |
The full-list pattern is 220 characters, inside GA4's 250-character limit for report filters. Each extra domain adds roughly its own length.
Why AI traffic still shows up as Referral
The pattern is rarely the problem. These are.
Channel order
GA4 assigns traffic to the first matching channel. If AI assistants sits below Referral, every AI visit matches Referral first.
Unanchored keywords
Patterns like .*gpt.*|.*ai also catch unrelated sites whose names contain those letters. Match whole domains.
Expecting every AI click to carry a referrer
Some apps open links without a referrer, so the visit lands in Direct. ChatGPT often adds utm_source=chatgpt.com, which GA4 then uses as the source.
Filtering on the wrong field
Session source holds hostnames; Page referrer holds full URLs. A hostname pattern with ^…$ will not match a URL, and vice versa.
AI assistants as a channel, without a regex
TapCub recognises these AI referrers on arrival and shows them as their own channel, so there is nothing to configure or reorder.
Sources with an AI channel
ChatGPT, Perplexity and the other assistants on a dedicated line next to search, social, email, ads and referrals.
Learn moreAI crawlers on the other side
See which AI crawlers read your pages in the bots report, next to the visits AI assistants send back.
Learn moreMarketing analytics
Compare AI assistants with paid and organic channels on conversions and ROI.
Learn moreAI referral traffic questions
Still have a question?
Chat with the team behind TapCub — we usually reply within a few hours on business days.
How do I track ChatGPT traffic in GA4?
Use this pattern in a custom channel group: Admin → Data display → Channel groups, add a channel with the condition Source matches regex, then move it above Referral. For a quick look, add a report filter on Session source in Traffic acquisition instead.
Doesn't GA4 already have an AI channel?
Yes, the default channel group now includes an "AI Assistant" channel, set when the referrer is on Google's own list. Google gives examples but no full list, so a custom channel or filter is the way to decide exactly which assistants count and to see them one by one.
What regex should I use for AI traffic in GA4?
The pattern above, generated from TapCub's list of 20 AI assistant domains: ^(.*\.)?(…)$ with the domains grouped by ending. It is valid RE2 and stays under GA4's 250-character limit for report filters.
Should I use matches regex or matches partial regex?
For channel groups use matches regex (the pattern is built for it). In report filters either works; partial match is more forgiving if values have extra characters, but the full form is stricter about look-alike domains.
Why is some AI traffic still in Direct?
If the assistant's app or the user's browser sends no referrer and there is no UTM tag, GA4 has nothing to classify. No regex can recover that; only links with UTM parameters or a referrer can be attributed.
Does TapCub classify AI assistant traffic automatically?
Yes. Every visit's referrer is checked against the same domain list when it arrives, and matches go to the AI assistants channel with the assistant's name. No custom rule or regex is needed.
Is anything I type uploaded?
No. The pattern is built and tested in your browser. The domain list and settings go into the share link after the #, which is never sent to a server.
Update history
New features, fixes and data refreshes for this tool, newest first.
-
· v1.0
LaunchedFirst release.
Data this tool relies on
- AI assistant referrer domains — checked 2026-11-10, reviewed every 3 months (next review by 2027-02-10)
Missing something or found an error? Tell us — requests that come up often go into the next update. All tool updates
See AI assistants as a channel from day one
Add the TapCub snippet and visits from ChatGPT, Perplexity, DeepSeek and others get their own line in Sources, with no channel rules to maintain.