Type a tool name, for example "keyword density" or "transcript".
Get the regex that finds visits from ChatGPT, Perplexity, Claude and other AI assistants in GA4, Looker Studio and BigQuery.
GA4 already has a built-in "AI Assistant" channel. Check it first, under Session primary channel group in your acquisition reports.
Use this pattern for assistants that channel may miss, for Explorations, segments and filters, for Looker Studio and BigQuery, and for older data.
Assistants to match
One host name per line, without https://. Up to 50.
Select at least one assistant, or add a host name, to get a pattern.
Some assistant apps and privacy settings send no referrer. Those visits show up as Direct, and no regex can recover them.
Visits from Google AI Overviews and AI Mode arrive from Google Search, so analytics counts them as Organic Search, not as AI.
Only ChatGPT documents a tag on its links (utm_source=chatgpt.com). Host names marked "reported, not confirmed" come from third-party reports, not from the assistant's own documentation.
An AI traffic regex generator builds the pattern you paste into GA4, Looker Studio or BigQuery to find visits from ChatGPT, Perplexity, Claude and other AI assistants. You tick the assistants, choose what the pattern is tested against, check it on sample lines, and copy it. It suits marketers and analysts who report on AI referrals.
A regex for AI traffic is a text pattern that matches the source or referrer of visits sent by AI assistants, so your analytics can group them. Instead of listing each host separately, the pattern joins them with the "or" symbol, so one value matches chatgpt.com, perplexity.ai, claude.ai and more.
In GA4 you paste the pattern as the value of a "matches regex" condition. Two things can be tested. One is the session source, which is a host name such as chatgpt.com. The other is the full referrer address, such as https://chatgpt.com/ followed by a path. The generator builds the right shape for either.
Dots in host names are escaped, so chatgpt.com cannot accidentally match a lookalike with a different character in place of the dot. The pattern also has start and end markers, so it matches the whole value instead of any longer domain that merely contains an assistant's name.
Yes, in several cases. GA4 already has a built-in "AI Assistant" channel, and you should check it first under Session primary channel group in your acquisition reports. A custom pattern covers what that channel does not.
Use the generated pattern when you need to:
You can get a working pattern in about a minute by following these steps.
Say you only care about two assistants. You tick ChatGPT and Perplexity, keep "a source name" selected, and leave subdomains and older addresses on. The pattern lists chatgpt.com, chat.openai.com and perplexity.ai, each with escaped dots, plus an allowance for a prefix such as www.
Now paste three lines into Try it:
chatgpt.com: matched, assistant ChatGPT.www.perplexity.ai: matched, assistant Perplexity, because subdomains are on.google.com: not matched.Untick Match subdomains too and the second line stops matching. That is the point of testing first: you see exactly what a setting changes before it touches your reports. Untick Include older addresses and a line such as chat.openai.com would drop out, which matters if you analyze data from before ChatGPT moved to its current domain.
Your result is one pattern, a length note, a test table and copy-ready snippets. Each part answers a different question.
GA4 limits a regex value to 256 characters. The length note shows where you stand. If you go over, a warning appears with a shorter alternative that leaves out older addresses, and you can click Use the shorter pattern. You can also untick assistants that never appear in your reports.
Each pasted line gets a result and, when it matches, the assistant it belongs to. A line you expected to match but did not usually has one of three causes: the assistant is not ticked, subdomains are off, or you are testing a full address while the mode is set to source name.
Pick the snippet for where you work. In a GA4 custom channel group, you add a new channel, name it, set the condition to match regex and paste the pattern. In an Explore segment, you add a session segment with the same kind of condition. The Looker Studio snippet wraps the pattern in a CASE formula, and the BigQuery snippet puts it in a WHERE clause against the lowercased value.
| Situation | Setting to choose | Why |
|---|---|---|
| Filtering on GA4 Session source | Source name | Value is a bare host |
| Filtering on a page referrer field | Referrer address | Value is a full URL |
| Pattern is over 256 characters | Shorter pattern | Drops older hosts |
Anyone who has to explain how much traffic comes from AI assistants will save time here. A few typical situations:
Referral visits are only half the picture. To see which AI crawlers fetch your pages, a tool such as the AI bot log analyzer reads server logs, and the AI crawler access checker shows whether your robots.txt lets those bots in.
Compare your custom channel with the built-in AI Assistant channel for the same dates. If the numbers are close, you may not need the custom group. If yours is higher, the difference shows which assistants the built-in rule misses.
The most common mistake is pasting a source-name pattern into a field that holds full URLs, or the reverse. Always choose the mode that matches the field you will paste into, then test with a real value copied from your report.
If you look at data from before an assistant changed domains, leave Include older addresses on. Turn it off only when you need the shorter pattern for the character limit.
New assistants appear often. Type the host without https:// under Extra host names, one per line. Invalid entries are flagged so you can fix them, such as a typo or a full path.
Hosts marked "reported, not confirmed" come from third-party reports, not from the assistant's own documentation. Include them if you see that traffic, but verify them against your own referral data before reporting.
In a GA4 custom channel group, order matters: channels are evaluated from the top, so a broader rule above your AI channel can take the visits first. Move the AI channel above anything that would claim those sources.
A regex can only match what your analytics recorded, so some AI visits stay invisible. Some assistant apps and privacy settings send no referrer. Those visits are logged as Direct, and no pattern can recover them. Claude, for instance, often sends no referrer, so part of its traffic lands in Direct.
Visits from Google AI Overviews and AI Mode arrive from Google Search, so analytics counts them as Organic Search. The generator covers assistant hosts such as Gemini, but not those search features.
Of the assistants listed, only ChatGPT documents a tag on its links (utm_source=chatgpt.com). For that reason, treat your AI figures as a minimum count, and use them to see trends, not to claim a full total.
Pick your assistants, test a few real referrers, and copy the snippet for your platform. Once your AI segment is running, the AI SEO tools collection has more ways to check how AI systems reach and read your pages. Use the AI traffic regex generator on this page and have a working GA4 pattern in a minute.
Your report has been submitted. We will look into this issue.
A VPN changes your network exit. It does not guarantee anonymity.
Themes, plugins, code, video, audio, graphics & more from 90,000+ authors.
Web Development
Design & Media
Unlimited Access
Explore Envato Market