GA4 Referral Exclusion Regex — Patterns for Unwanted Referrals
Payment gateways, password-reset emails and your own legacy domains all arrive in GA4 as referral traffic — checkout flows restart sessions and a Stripe return visit gets credited to Stripe. List unwanted referrals fixes that at the source: one regex condition per row tells GA4 to append ignore_referrer=true and stop treating that domain as a traffic source. This page gives you the patterns, the two rules that decide whether they work, and a tester to verify them first.
TL;DR: Admin → Data collection and modification → Data streams → web stream → Configure tag settings → Show all → List unwanted referrals. GA4 regex here is a full match (wrap with .*) and runs on RE2 (no lookaround). Max 50 conditions, evaluated with OR — so merge your list into one alternation pattern. Editor role required.
Where the setting lives
- Open Admin → Data collection and modification → Data streams
- Click your web data stream
- At the bottom, Configure tag settings
- Click Show all, then List unwanted referrals
- Under Include referrals that match ANY of the following conditions: pick a match type, enter the domain, Add condition for each next one, then Save
Conditions are evaluated with OR logic, you get a maximum of 50 per data stream, and you need the Editor role at property level. The dropdown offers several match types — contains and exactly matches among them — but only matches RegEx lets one row carry a whole group of domains, which is what the 50-condition cap makes worthwhile.
The two rules every pattern here must obey
- Full match. The pattern must match the entire domain value.
paypal\.commatches the hostnamepaypal.combut notwww.paypal.com— the most common reason a saved condition silently does nothing. Wrap it:.*paypal\.com. Both behaviors are covered in depth on the GA4 regex match types page. - RE2 engine. No lookahead, no lookbehind, no backreferences.
(?!...)is rejected outright — exclusion in GA4 is done by listing what to ignore, not by negative patterns. Every pattern below is RE2-safe; the RE2 vs PCRE guide lists each unsupported construct with its replacement.
Hostnames arrive lowercase, so keep your patterns lowercase too. And test before saving: each pattern below has a Try link that loads it into the tester with a realistic hostname — paste your own referrer values from Traffic acquisition → secondary dimension Session source and confirm the match first.
5 ready-made unwanted-referral patterns
Replace example.com with your own domains in rows 2 and 3. Every pattern assumes GA4's full-match semantics, so the leading and trailing .* are doing real work — don't strip them.
| Purpose | Regex (matches RegEx) | |
|---|---|---|
| Payment gateways — stop checkout returns crediting Stripe/PayPal | .*(stripe\.com|paypal\.com|braintreegateway\.com|adyen\.com|klarna\.com|checkout\.com|razorpay\.com|paddle\.com) |
Try → |
| Your own legacy/secondary domains (not in cross-domain setup) | (?:(www|blog|app|shop)\.)?example\.com |
Try → |
| Email click & password-recovery domains acting as "your business" | .*(mailchi\.mp|list-manage\.com|mailchimpapp\.net|sendgrid\.net|click\.example\.com) |
Try → |
| Referral spam that pollutes source/medium | .*(semalt\.com|buttons-for-website\.com|darodar\.com|cenoval\.ru|social-buttons\.com) |
Try → |
| Merged pattern — gateways + spam in ONE condition (saves 50-row slots) | .*(stripe\.com|paypal\.com|braintreegateway\.com|adyen\.com|klarna\.com|checkout\.com|razorpay\.com|paddle\.com|semalt\.com|buttons-for-website\.com|darodar\.com|cenoval\.ru|social-buttons\.com) |
Try → |
Row 3 is only right when the email domain genuinely is an aspect of your business — Google's own example is a password-recovery flow whose traffic should not read as a third-party source. If you want to see newsletter referrals, don't exclude them; tag the links instead with the patterns from the UTM parameter regex page.
The full-match trap (and the unescaped dot)
Two mistakes account for most conditions that "don't work". Both are visible in one click:
| Pattern | Hostname | Result | |
|---|---|---|---|
paypal\.com |
www.paypal.com |
No match | Try → |
.*paypal\.com |
www.paypal.com |
Match | Try → |
paypal.com (dot unescaped) |
paypalXcom |
Match — wrong | Try → |
paypal\.com (dot escaped) |
paypalXcom |
No match — correct | Try → |
The same logic protects you from suffix tricks: .*stripe\.com full-matches checkout.stripe.com but rejects stripe.com.evil.example, because the value has to end with the escaped domain.
What exclusion does — and does not — change
Google's mechanics: when a condition matches, GA4 appends ignore_referrer=true to every event sent from pages where the Google tag runs, and the referrer stops being displayed as a traffic source. What that means in practice:
| Question | Answer |
|---|---|
| Retroactive? | No — applies to hits from the moment you save |
| Deletes data? | No — the referrer simply isn't credited as a source |
| Past sessions safe from the excluded domain? | Not entirely — last non-direct click can keep crediting it within the lookback window |
| UTM-tagged links affected? | No — campaign parameters still set source/medium |
| Own domain auto-handled? | Yes — self-referrals and _gl cross-domain links are ignored automatically |
That third row is the trap people hit a week later: exclude the gateway, see it still attributed for a few days, and conclude the regex failed. It didn't — you're watching sessions that started before the change, re-attributed by the last-non-direct-click model. New sessions are clean immediately.
Referral exclusion vs channel group vs UTM
| Layer | What it changes | Retroactive? | Use it for |
|---|---|---|---|
| List unwanted referrals | Raw referrer stops being a traffic source on new hits | No | Payment gateways, transactional domains |
| Custom channel group | Reclassifies the channel dimension at query time | Yes | Fixing Unassigned / channel taxonomy |
| UTM parameters | Sets campaign source explicitly on tagged links | No | Newsletters, partners, paid campaigns |
| Report filter | Hides rows in one view only | No | Ad-hoc analysis |
Confused which layer owns a number in your report? The Unassigned traffic fix guide walks the diagnosis, and the custom channel grouping regex guide covers the middle row in full. They solve different problems — excluding Stripe as a referral does nothing to a channel-group taxonomy, and vice versa.
Debug before you save
- Read your real hostnames first: Traffic acquisition → secondary dimension Session source → note the exact domains (including
www.and subdomains). - Paste each pattern + hostname into the tester below — full-match semantics, exactly as GA4 reads it. No match there means no match in GA4.
- Escape every dot in the domain;
checkout.comotherwise also matchescheckoutXcom. - Don't end a pattern with
|— the empty alternative matches everything and your condition quietly swallows all referrals. - Merge to stay under 50. One alternation row is one condition; keep the merged pattern readable by grouping with escaped domains only.
- Save, then verify in DebugView on a test session that bounces back from the gateway domain.
FAQ
Does adding a referral exclusion change my historical data?
No. The setting appends ignore_referrer=true to events sent after you save it, so only future hits change. Past sessions keep their attribution — and because GA4 uses last non-direct click, a user who first arrived from an excluded domain can still show that domain on later direct visits until the lookback window expires.
What's the difference between referral exclusion and a custom channel group?
The unwanted-referrals list works at hit level: the raw referrer stops being recorded as a traffic source. A custom channel group reclassifies the channel dimension in reports and is applied at query time, so it re-sorts history. Use the exclusion list for payment gateways and transactional domains; use channel groups to fix what your channel report shows — see the channel grouping guide.
Why doesn't paypal.com match www.paypal.com?
Full match: the pattern must cover the entire domain value. Wrap it — .*paypal\.com matches the bare domain, www.paypal.com and any subdomain, or use (?:(www|checkout)\.)?paypal\.com to be precise. Always escape the dot: paypal.com also matches paypalXcom. Test against your real hostnames in the match types guide semantics before saving.
How many unwanted referral conditions can I add?
Google caps it at 50 per data stream, evaluated with OR logic. Since one regex row counts as one condition, merging your list into a single alternation — like the merged pattern above — uses one slot instead of thirty. If you ever need more than 50 alternations, you have a categorization problem, not a regex problem.
Do I still need to list my own domain for self-referrals?
Usually not. GA4 automatically ignores referrers that match your domain or its subdomains, and cross-domain measurement with the _gl linker parameter is handled too. Only add domains you own that are not in that setup — legacy domains, staging hosts or separate brand domains.
Related on RegexLab: the Unassigned traffic regex fix guide, the custom channel grouping regex guide, GA4 regex match types (full vs partial per surface), the GA4 regex cheat sheet, UTM parameter regex, extract domain regex and RE2 vs PCRE. For ready-made patterns beyond GA4 (dates, emails, URLs, IPs, UUIDs, log lines and more), browse the regex pattern library.