Sub topic 10
Configuring the unwanted referrals list
This chapter assumes you can open the Admin area of a GA4 property and that you know what a session, a source and a medium are. It also assumes you read the previous chapter on how GA4 decides a session's referral source. Here you configure the unwanted referrals list, which changes that decision for domains you choose.
What the list does
When a visitor arrives from another website, the browser sends a referrer, which is the address of the page the visitor came from. GA4 normally treats a new referrer as a new traffic source and starts a new session. That is correct for a link on a news site. It is wrong for a payment gateway, a single sign-on page or a booking widget, because the visitor never really left your journey.
A typical failure looks like this:
- A visitor arrives from a Google ad and adds a product to the cart.
- The visitor is sent to
paypal.comto pay. - PayPal sends the visitor back to your thank-you page.
- GA4 sees
paypal.comas the referrer and starts a new session with sourcepaypal.comand mediumreferral.
The purchase is now credited to PayPal. The ad that earned the sale gets nothing, and your session count rises by one.
The unwanted referrals list tells GA4 to ignore the referrer when it comes from a listed domain. GA4 does not start a new session for that visit. The session keeps the source and medium it already had. If the visitor has no earlier source, the session is attributed to direct.
Where to find the list
The list belongs to a web data stream, not to the property as a whole. To open it:
- Go to Admin and open Data collection and modification, then Data streams.
- Select the web data stream.
- Under Google tag, select Configure tag settings.
- Select Show all, then List unwanted referrals.
You need Editor access or higher. Each stream has its own list, so a property with several web streams needs the rule added to each one that is affected.
Building a rule
Each rule has a match type and a domain value. GA4 compares the value to the referrer's domain, not to the full URL. A rule has the form "Referral domain" plus a condition. The common conditions are in this table. The exact labels in the interface can change, so read them on screen.
| Match type | Matches when the referrer domain | Example value | Matches |
|---|---|---|---|
| Contains | includes the text anywhere | `paypal` | `paypal.com`, `paypal-fans.net` |
| Exactly matches | equals the text | `checkout.stripe.com` | only that hostname |
| Begins with | starts with the text | `secure.` | `secure.bank.example` |
| Ends with | finishes with the text | `.paypal.com` | `www.paypal.com`, not `paypal.com` |
| Matches regex | fits the regular expression | see below | depends on the pattern |
You can add several conditions. A visitor's referrer is ignored if it matches any one of them. GA4 limits the list to 50 conditions, so rules that cover many domains at once are worth the effort.
Why "contains" is risky
A "contains" rule on paypal also suppresses a genuine referral from a blog called paypal-fan-blog.example. You would silently lose real referral traffic from that site. Use the narrowest match type that covers what you need.
Covering a domain and its subdomains
Payment providers often use several hostnames, such as www.paypal.com and checkout.paypal.com. A single regular expression can cover the bare domain and every subdomain:
^(.+\.)?paypal\.com$The pattern works in these parts:
^and$anchor the match to the start and end of the domain, so nothing extra can appear before or after.(.+\.)?is an optional group. It accepts any subdomain text followed by a literal dot, or nothing at all.paypal\.comis the domain itself. The backslash makes the dot a literal dot instead of "any character".
You can check a pattern before you paste it into GA4. This Node.js script tests it against domains you expect to match and domains you do not:
const pattern = /^(.+\.)?paypal\.com$/;
const samples = [
'paypal.com',
'www.paypal.com',
'checkout.paypal.com',
'notpaypal.com',
'paypal.com.evil.example',
'paypal-fan-blog.example'
];
for (const domain of samples) {
console.log(domain.padEnd(28), pattern.test(domain) ? 'ignored' : 'kept');
}The first three lines print ignored. The last three print kept, which is the correct result. In particular, notpaypal.com is not matched, because (.+\.)? requires a dot before paypal.
Which domains belong on the list
Add a domain when visitors leave your site in the middle of a journey and come straight back. Typical candidates:
- Payment gateways and hosted checkouts.
- Single sign-on and login providers, for example an identity service that redirects through its own domain.
- Third-party booking, ticketing or form tools that return the visitor to your site.
- Your own other domains that are not covered by cross-domain measurement, such as a separate checkout host.
Do not add a domain only because it sends you traffic you dislike. A rule hides the referral from GA4 entirely, so a real campaign link or a partner site you want to measure would disappear from your reports. The list is for domains that interrupt a session, not for domains you would like to ignore.
Working through an example
Suppose a shop sells through shop.example. Checkout redirects to pay.gateway.example and returns to shop.example/thanks. Traffic acquisition shows 340 sessions from pay.gateway.example / referral, and the paid search channel looks weak.
- Open the stream's tag settings and select List unwanted referrals.
- Select Add condition.
- Choose Referral domain exactly matches and enter
pay.gateway.example. - Select Save.
The gateway may also use other hostnames. Open the report first and look at the source values that appear. If you see pay.gateway.example and secure.gateway.example, replace the single rule with one that matches both, for example "Referral domain ends with" .gateway.example.
Verifying the change
Unlike data filters, the unwanted referrals list has no Testing state. The rule takes effect when you save it, so check it carefully.
- Before saving, record the number of sessions for the gateway domain. Use Reports, Acquisition, Traffic acquisition with Session source / medium as the dimension.
- Save the rule. Allow up to 24 hours before you judge the result, because the setting can take time to reach every tag.
- Run a test purchase or login that passes through the listed domain.
- After processing, compare Session source / medium. The gateway domain should stop appearing for new sessions, and your original channels should keep the credit.
- Check that the sessions per user figure has not changed in an unexpected way. Fewer sessions for the same users means the extra sessions were removed.
Common errors
- Using a full URL. The rule compares domains. Entering
https://pay.gateway.example/checkoutmatches nothing. Enter the hostname only. - Forgetting a hostname. Gateways often use more than one. If the old domain keeps appearing, a second hostname is probably involved.
- Unescaped dots in a regular expression.
paypal.comunescaped also matchespaypalXcom. Escape each dot. - Missing anchors. Without
^and$, a regular expression matches anywhere inside the domain. A pattern likepaypal\.comalso matchespaypal.com.evil.example. - Editing the wrong stream. Rules in one web stream do not affect another stream in the same property.
- Expecting a cleanup. The list changes how new sessions are attributed. It does not delete or reassign old sessions.
What the list cannot do
- It does not block traffic. The visitor, their events and their page views are still collected. Only the referral attribution is ignored.
- It does not fix a session that GA4 has already split, such as when the visitor's session timed out during a long checkout.
- It does not handle referrers that the browser strips. If a redirect removes the referrer, the visit already looks like direct traffic, and no rule can recover the original source.
- It does not replace the internal traffic filter. Your own staff visits are excluded by IP rules and data filters, covered in earlier chapters, not by this list.
Exercise
A shop's Traffic acquisition report shows many sessions with source checkout.payments.example and medium referral, and the same visitors also appear under paid search. You want one rule that ignores checkout.payments.example, www.payments.example and payments.example, but not payments.example.net. Which regular expression do you use, and why is it better than a "contains payments" rule?
Show answer
Use ^(.+\.)?payments\.example$. The anchors ^ and $ stop the pattern matching payments.example.net, the optional (.+\.)? group covers checkout. and www. as well as the bare domain, and the escaped dot matches only a literal dot. A "contains payments" rule would also hide real referrals from any unrelated site with "payments" in its name.
Exercise
You save an unwanted referral rule on Monday. On Tuesday you compare last month's gateway referral sessions with this week's and see them drop to zero. Why is it wrong to report this as a real change in user behaviour, and what should you do?
Show answer
The rule is not retroactive and it only changes attribution for new sessions, so the drop comes from the setting and not from visitors. Annotate Monday as the date the rule started, and compare periods before and after only with that change in mind.