Website Tracking Tools
GA4 AI-Referral Regex Builder
Create a regular expression that matches the referral source domains of well-known AI assistants, ready to paste into a GA4 exploration, report filter or custom channel group. The default list covers common assistant domains, and you can edit it, choose contains or exact matching and test the pattern against sample sources. The list is a starting point, not a complete or permanent record: platforms change domains, and many visits from AI tools arrive with no referrer at all, so this cannot measure all AI-driven traffic. Check the sources that actually appear in your own GA4 data.
How to use it
- Review and edit the list of domains, one per line.
- Choose contains or exact matching and test a few sample sources.
- Copy the regex into a GA4 filter set to “matches regex”, then check it against your own data.
Example
The list chatgpt.com and perplexity.ai becomes (chatgpt\.com|perplexity\.ai), which matches the source “chatgpt.com” and “perplexity.ai” but not “google”.
Measure honestly
Use the result as one signal alongside branded search and direct traffic trends, and say plainly that it undercounts. Tag links you control with the UTM builder where you can.
Questions
Will this capture all traffic from AI tools?
No. Many AI products send no referrer, or open links in ways that appear as direct traffic. The regex captures only visits that carry a matching source.
Where do I use the regex in GA4?
In Explore reports, report filters and custom channel group conditions, using a “matches regex” or “contains” condition on Session source, Page referrer or similar. The exact options change, so test it on your own data.
Why is there no lookahead in the regex?
GA4 uses RE2-style matching, which does not support lookaround or backreferences, so the generated pattern sticks to plain alternation.
How often should I update the list?
Check your referral reports regularly and add or remove domains as products change names or addresses.
Does the tool connect to Google Analytics?
No. It builds text locally and sends nothing to Google or anyone else.
Get practical SEO tips by email
Occasional emails with new guides and tools. Confirm by email first; unsubscribe in one click.
