Advertisement

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

  1. Open Admin → Data collection and modification → Data streams
  2. Click your web data stream
  3. At the bottom, Configure tag settings
  4. Click Show all, then List unwanted referrals
  5. 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

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.

PurposeRegex (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:

PatternHostnameResult
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:

QuestionAnswer
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

LayerWhat it changesRetroactive?Use it for
List unwanted referralsRaw referrer stops being a traffic source on new hitsNoPayment gateways, transactional domains
Custom channel groupReclassifies the channel dimension at query timeYesFixing Unassigned / channel taxonomy
UTM parametersSets campaign source explicitly on tagged linksNoNewsletters, partners, paid campaigns
Report filterHides rows in one view onlyNoAd-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

  1. Read your real hostnames first: Traffic acquisition → secondary dimension Session source → note the exact domains (including www. and subdomains).
  2. Paste each pattern + hostname into the tester below — full-match semantics, exactly as GA4 reads it. No match there means no match in GA4.
  3. Escape every dot in the domain; checkout.com otherwise also matches checkoutXcom.
  4. Don't end a pattern with | — the empty alternative matches everything and your condition quietly swallows all referrals.
  5. Merge to stay under 50. One alternation row is one condition; keep the merged pattern readable by grouping with escaped domains only.
  6. Save, then verify in DebugView on a test session that bounces back from the gateway domain.
Test your exclusion pattern before pasting it into GA4
Load any pattern above with its sample hostname, then swap in your own referrer values from GA4.
Open the regex tester →

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.