GA4 Cross-Domain Tracking and Unwanted Referrals: How to Fix Them

By the Mayab Media Team · Level: Intermediate · Time: 45 minutes

You check your GA4 traffic report and find that your best "referral" source is your own booking engine, or a payment gateway, or your second domain. Purchases and leads that started with a Google Ads click now show up as referrals from the checkout. Your ad reports look weak while the payment processor looks like a star.

This happens when a visitor moves between domains during one visit. GA4 identifies users with a first-party cookie, and cookies don't travel across domains. So when someone leaves example.com for book.example-booking.com, GA4 sees a new visitor arriving from a referral. When they come back from a payment page, the referrer is the gateway.

There are two separate fixes, and people mix them up. Cross-domain measurement joins domains that you own and tag with the same GA4 tag, so one visit stays one visit. Unwanted referrals tells GA4 to ignore sites you don't control, like payment gateways, so they never get credit. Most sites with a checkout or booking step need one or both.

Quick answer

  1. List every domain in the user journey and mark which ones you control and can tag.
  2. Put the same GA4 tag (G-XXXXXXXXXX) on every page of each domain you own.
  3. In GA4, go to Admin > Data streams > your web stream > Configure tag settings > Configure your domains and add each domain.
  4. In the same area, open List unwanted referrals and add third-party domains such as payment gateways.
  5. Test: click a link between domains and confirm the URL carries _gl=.
  6. After a few days, check Traffic acquisition for your domains and gateways as sources.

Before you start

  • Access: Editor role or higher on the GA4 property, and access to the tag on each domain (GTM or the site code).
  • A map of the journey. Click through a real purchase or booking and write down every domain you pass. Include redirects and payment pages.
  • Tag Assistant (tagassistant.google.com) to watch hits across domains.
  • Time: about 45 minutes, plus a few days of data to confirm.
  • No backup needed in GA4, but note the current settings in case you want to revert.

Sort your domains into these groups.

Domain type Example Fix
Your own domains with your tag example.com, shop-example.com Cross-domain measurement
Subdomains of your site blog.example.com, shop.example.com Usually nothing, GA4 handles them by default
Third-party sites you can't tag payment gateways, card verification pages, a bank's 3-D Secure step Unwanted referrals
Third-party tools you can tag some booking engines or event ticketing platforms Cross-domain, if they let you add your GA4 ID

Subdomains of the same root domain share the cookie by default, so they don't need cross-domain setup. Google still suggests adding them to the domain list to prevent self-referrals in edge cases.

Step 1: Use the same GA4 tag on every domain

Cross-domain measurement only works if every domain sends data to the same web data stream. Open each domain and confirm the tag ID.

The fastest way is Tag Assistant. Connect to example.com, then browse to your second domain in the same window. Tag Assistant follows you and shows the tag on each domain. Look for the same G-XXXXXXXXXX on both.

If the second domain is a third-party booking engine or store builder, look in its settings for a field like "Google Analytics measurement ID" or "Google tag." Enter your G- ID there. If it only accepts an old Universal Analytics ID (UA-), it can't help with GA4 and you'll treat it as a third party instead.

tagassistant.google.comTag Assistant22 domains connectedSUMMARYexample.combook.example-bookin…Connected domainsDebug sessionDomainTag foundStatusexample.comG-XXXXXXXXXXFoundbook.example-booking.comG-XXXXXXXXXXFound✓Both domains send to the same Google tag. Cross-domain linking can work.1
Figure 1. The same tag ID on both domains is the precondition for cross-domain measurement. Illustration of the screen. Labels can differ slightly in your account.
  1. Same tag on the second domain. If it's different or missing, fix that first.

Step 2: Configure your domains in GA4

Now tell the Google tag which domains to link. GA4 will then add a _gl parameter to links between them, carrying the client and session IDs across.

  1. In GA4, click Admin.
  2. Under Data collection and modification, click Data streams.
  3. Click Web, then your web data stream.
  4. At the bottom, click Configure tag settings.
  5. In Settings, click Configure your domains.
  6. Under Recommendations, GA4 may suggest domains it already saw with your tag. Click Add to accept them.
  7. To add one by hand, click Add condition, choose a match type (for example Contains), and enter the domain, such as example-booking.com.
  8. Add all your domains, including the main one, then click Save.
analytics.google.com/analytics/web/#/admin/streams/tag-settingsGoogle AnalyticsEexample.com - GA4Configure your domainsGoogle tag > SettingsRecommendationsshop-example.comSeen with this tagAddInclude domains that match ANY of the following conditionsMatch typeDomainContainsexample.comContainsexample-booking.comAdd conditionSave123
Figure 2. Add every domain in the journey that carries your GA4 tag. Illustration of the screen. Labels can differ slightly in your account.
  1. GA4 suggests domains it has seen with your tag.
  2. Your manual conditions. They're evaluated with OR logic.
  3. Save. Changes apply to the Google tag within a short time.

A note for GTM users. If GA4 runs through a Google tag in GTM, this admin setting applies automatically, because the Google tag loads its settings from GA4. You don't need extra linker fields in GTM.

Step 3: List unwanted referrals

Next, handle sites you can't tag. A payment gateway sends the buyer back to your thank-you page. Without a fix, that return looks like a referral.

  1. Go back to Configure tag settings for the same stream.
  2. In Settings, click Show all.
  3. Click List unwanted referrals.
  4. Under Include referrals that match ANY of the following conditions, pick a match type and enter the domain, for example paypal.com or your gateway's checkout domain.
  5. Click Add condition for each extra domain, then Save.
analytics.google.com/analytics/web/#/admin/streams/tag-settingsGoogle AnalyticsEexample.com - GA4List unwanted referralsGoogle tag > SettingsInclude referrals that match ANY of the following conditionsMatch typeDomainReferral domain containspaypal.comReferral domain containscheckout.example-pay.comReferral domain contains3ds.example-bank.comAdd conditionSaveiUp to 50 unwanted referrals per data stream.12
Figure 3. Add gateways and verification pages that send buyers back to your site. Illustration of the screen. Labels can differ slightly in your account.
  1. Third-party domains to ignore as referrers. Match type labels may differ in your account.
  2. Save.

GA4 adds ignore_referrer=true to hits that match. That means the referrer is ignored, and the visit keeps its original source. You can add up to 50 conditions per stream.

Don't add your own booking or shop domain here as a shortcut. Listing it as unwanted hides the referral but doesn't join the user and session, so you still get two users and broken journeys. Use cross-domain for domains you can tag.

To find gateway domains you missed, open Reports > Acquisition > Traffic acquisition, change the dimension to Session source / medium, and search for referral. Payment, bank and verification domains near the top of the list belong here.

analytics.google.com/analytics/web/#/report/traffic-acquisitionGoogle AnalyticsEexample.com - GA4HomeRealtimeREPORTSTraffic acquisitionUser acquisitionExploreAdminTraffic acquisitionSession source / mediumreferralSession source / mediumSessionsKey eventspaypal.com / referral212148book.example-booking.com / referral18061news-site.example / referral95212
Figure 4. A gateway or your own booking domain with many key events is the classic sign of this problem. Illustration of the screen. Labels can differ slightly in your account.
  1. Filter the table for referral.
  2. A payment domain with lots of key events goes to unwanted referrals. Your own booking domain goes to cross-domain.

Step 4: Test the link decoration

Open your main site in a fresh browser window. Click a link or submit a form that takes you to the second domain. Look at the address bar on arrival. You should see a parameter like this:

https://book.example-booking.com/?_gl=1*1abc2de*_ga*MTIzNDU2Nzg5LjE3MDAwMDAwMDA.*_ga_XXXXXXXXXX*MTcwMDAwMDAwMC4xLjEuMTcwMDAwMDAwMC4wLjAuMA..

The value will look different, which is fine. What matters is that _gl= is present.

book.example-booking.com/?_gl=1*1abc2de*_ga*MTIzNDU2...ChromeBooking pageArrived from example.comAddress barhttps://book.example-booking.com/?_gl=1*1abc2de*_ga*MTIz...Choose your datesCheck-inSelect a dateSearch availability1
Figure 5. The _gl parameter carries the GA4 IDs across domains. It must survive until the page loads. Illustration of the screen. Labels can differ slightly in your account.
  1. If _gl is missing here, the link isn't being decorated or a redirect stripped it.

The linker only decorates links and forms the user clicks or submits. It won't decorate navigation triggered by JavaScript, like window.location = ... in a button script. It also fails when a script stops click events from bubbling up. See the troubleshooting table below.

Step 5: Watch out for iframes and redirects

Embedded booking widgets. Many booking engines load inside an iframe on your page. The cross-domain linker decorates links, not iframes. An iframe on another domain also can't read your cookies in most browsers. Ask the vendor whether they support passing the GA4 client ID into the iframe, or if they can send purchase data to your GA4 property themselves. Otherwise, link out to the booking domain instead of embedding it.

Redirects. If your link goes through a redirect (a URL shortener, a language redirect, an http to https hop), the redirect may drop query parameters. Then _gl never arrives. Fix the server or plugin so it keeps the query string, or link straight to the final URL.

Payment return URLs. Some gateways send the buyer back with a long URL and no referrer. Others send the referrer. The unwanted referrals list covers the second case.

Still not working? Common causes

Symptom Likely cause Fix
Your own second domain still shows as a referral Domain not in Configure your domains, or a different tag ID on that domain Add the domain. Use the same G- ID on both sides
_gl missing after clicking Navigation done by JavaScript, or a script calls stopPropagation() Use real <a href> links or forms. Ask the developer to stop blocking clicks
_gl appears, then vanishes Redirect or the destination app strips unknown query parameters Preserve query strings through redirects. Ask the vendor to allow _gl
_gl arrives but users still double Destination page loads the tag before it reads the URL, or uses another stream Confirm the same data stream. Make sure no extra Google tag with different settings runs
Payment gateway still gets purchase credit Gateway domain not listed, or listed with a typo or wrong match type Check the exact domain in Traffic acquisition. Add it with a "contains" style match
Old sessions still show the gateway Unwanted referrals don't rewrite past data Judge from new data after the change
Booking widget in an iframe shows no purchases Iframe on another domain can't share the cookie or gets no _gl Use vendor GA4 support, client ID passing, or link out
Subdomain shows as a referral Custom cookie domain set to one subdomain Use the default (auto) cookie domain. Add the root domain to the domain list
Lots of (direct) / (none) on thank-you pages Gateway sends no referrer and the session expired during payment Normal for slow payments. Keep the session timeout default or longer

Cross-domain vs unwanted referrals in one line

If you can put your GA4 tag on it, use cross-domain. If you can't, list it as an unwanted referral.

How to confirm it's fixed

  1. Run Tag Assistant across both domains. Start on example.com, click to the second domain, finish a test conversion. Each hit should carry the same client ID. You can see it as the cid parameter in the collect requests in Chrome DevTools, on the Network tab.
  2. Check Realtime. Your test visit should appear as one user moving across both domains.
  3. Wait 3 to 7 days, then open Reports > Acquisition > Traffic acquisition with Session source / medium. Your own domains and the gateways should drop sharply or disappear as referral sources.
  4. Compare key events by channel before and after. Paid and organic channels often gain the credit that the gateway used to take. Treat this as a direction, not a precise number.
  5. Re-test after site changes, such as a new booking vendor or checkout redesign.

For a full GA4 data check, see our GA4 troubleshooting guide. If ad clicks lose their source on the way, read the UTM guide too.

FAQ

Do I need cross-domain tracking for subdomains?

Usually not. GA4 sets its cookie on the root domain by default, so www.example.com and shop.example.com share it. Add the root domain to the list anyway if you see self-referrals.

Can I fix PayPal showing as a referral with cross-domain measurement?

No. You can't put your tag on PayPal. Add it under List unwanted referrals instead.

Will this fix my old data?

No. Both settings apply only to data collected after you save them.

My booking engine is in an iframe. What can I do?

Ask the vendor if they support GA4 cross-domain or client ID passing. If not, link to the booking domain instead of embedding it, and make sure the vendor page carries your GA4 tag.

Does the _gl parameter hurt SEO?

It's added only on clicks between your linked domains, not in the HTML search engines crawl. Keep canonical tags on your pages so any shared URL with _gl still points to the clean version.

Stuck on this one? We fix these for clients every week. Book a free audit

Sources

Previous
Previous

UTM Parameters Guide: Build, Name and Fix "Unassigned" in GA4

Next
Next

How to Track Form Submissions with Google Tag Manager and GA4