Build your regex
In GA4, filter Session source with "matches regex" and a pattern wrapped in .*( … ).*, for example .*(chatgpt\.com|perplexity\.ai|copilot\.microsoft\.com|gemini\.google\.com|claude\.ai).*. GA4 requires a full match, so the wrapper is what makes it work. Treat the result as the minimum number of AI visits, because some arrive with no referrer.
The full-match trap
Google's Analytics help explains that in a GA4 property a regex is a full match by default: the pattern India matches only "India". Universal Analytics used partial matching, so patterns copied from older guides silently return nothing.
| Pattern | Value chatgpt.com | Value chatgpt.com / referral |
|---|---|---|
chatgpt\.com | Matches | No match in GA4 |
.*chatgpt\.com.* | Matches | Matches |
.*(chatgpt|perplexity)\.(com|ai).* | Matches | Matches, but also perplexity.com and chatgpt.ai |
The last row shows why the generator lists full domains instead of clever shortcuts: a compact pattern can match look-alike domains you did not intend to count.
Where to use it
- Quick look: Reports → Acquisition → Traffic acquisition, add a filter on Session source, condition "matches regex", paste the pattern.
- Exploration: a free-form exploration with Session source and Landing page as dimensions, filtered by the regex. This shows which pages AI assistants send people to.
- Permanent channel: Admin → Data display → Channel groups, copy the default group, add a channel such as "AI assistants" with Session source matching the regex, and move it above Referral so it wins.
# Example custom channel rule
Channel name: AI assistants
Condition: Session source matches regex
.*(chatgpt\.com|chat\.openai\.com|perplexity\.ai|copilot\.microsoft\.com|gemini\.google\.com|claude\.ai).*
Order: above "Referral"
Why the count is a floor
- Tagged links: OpenAI says ChatGPT adds
utm_source=chatgpt.comto referral URLs from ChatGPT search, so those visits show up even when the browser drops the referrer. - Untagged links: other assistants may not add a tag. When a desktop app, a privacy setting or a copied link removes the referrer, the visit becomes Direct.
- Server-side counting helps. Logging referrers on your own server, as this site does without cookies, catches visits that client-side analytics miss when a script is blocked.
Spotting new assistants before your regex knows them
New AI products appear every few months, and each one sends traffic from its own domain. Once a month, open Traffic acquisition, set the dimension to Session source, filter to the medium referral and search the list for words like ai, chat, gpt or assistant. Add any real assistant you find in the "other domains" box above and update your channel rule.
Check a domain before you add it: open it and confirm it is an assistant, not a directory or a scraper with "ai" in its name. Counting the wrong domain is worse than missing a small one, because it inflates the number you report.
Visits are one half of AI visibility. The other half is being cited at all, which only Bing measures for its own assistant today; see the Bing AI Performance guide.
Questions people ask
Why does my regex find nothing in GA4?
GA4 treats a regular expression as a full match by default, so chatgpt\.com only matches a value that is exactly chatgpt.com. Wrap the pattern in .*( ).* so it matches the domain anywhere in the value.
Does ChatGPT tag its links?
Yes. OpenAI's publisher FAQ says ChatGPT automatically adds utm_source=chatgpt.com to referral URLs from ChatGPT search, which GA4 reads as the session source.
Why is AI traffic probably higher than the report shows?
Some visits arrive without a referrer, for example from desktop apps or links copied out of a chat, and GA4 files them under Direct. A referrer-based filter counts only the visits that kept their source.
Should I build a custom channel group for AI?
If you report on it every month, yes. A custom channel group with an AI assistants channel, placed above Referral, keeps these visits out of the generic referral bucket in every standard report.
Related
Sources
- Google Analytics Help: About regular expressions (full match in GA4), accessed 2026-11-12.
- OpenAI Help: Publishers and developers FAQ, utm_source=chatgpt.com (archived 4 Oct 2026; OpenAI removed the article after retiring ChatGPT Atlas), accessed 2026-11-14.
- Google Analytics Help: Custom channel groups, accessed 2026-11-12.
- RE2 syntax reference, accessed 2026-11-12.