How-to

Cross-Domain Tracking in GA4 with GTM

Cross-Domain Tracking in GA4 with GTMkeep it one sessionsite.comcheckout →checkout.comsame session ✓?_gl=1a2b3c

If your funnel spans two domains, your site and a separate checkout, booking tool, or payment host, GA4 will often count one visitor as two, and credit the conversion to the wrong source. Cross-domain tracking stitches the journey together. Here's how it works and how to set it up in GTM.

Why cross-domain tracking matters

GA4 identifies a visitor with a client id stored in a first-party cookie, which is scoped to one domain. When the user crosses to a second domain, that cookie doesn't come along, so GA4 starts a brand-new session and user. The result: inflated users, a broken funnel, and self-referral (your own checkout domain showing up as the traffic source).

site.comsession A→ checkout.comnew session?Linkedone journey

How the linker works

GA4's cross-domain linker carries the client id across the boundary by decorating outbound links to the other domain with a _gl parameter. The second domain reads it and adopts the same client id, so the session continues as one journey.

Setting it up in GTM

  1. Make sure both domains have the GA4 tag, ideally with the same Measurement ID.
  2. In the GA4 configuration (the Google Tag), open the cross-domain settings and add both domains to the list.
  3. Add the other domain to GA4's unwanted referrals / referral exclusions so it doesn't register as a traffic source.
  4. Publish and test a full cross-domain journey.

Watch the linker survive

The _gl parameter has to actually reach the second domain. Anything that strips query parameters on the link or redirect (a too-aggressive redirect, a link that opens via JavaScript) breaks the handoff.

How to verify it works

  • Click from domain A to domain B and confirm the URL carries a _gl= parameter.
  • In GA4 Realtime, confirm the journey stays a single user/session across the two domains.
  • Check that domain B no longer appears as a source/medium in acquisition reports.

Practice this on a real container

Decorating cross-domain links and verifying the _gl parameter is fiddly the first time. Practice the cross-domain linker on your own container and watch the handoff actually happen.

Practice cross-domain linking →

Common pitfalls

  • Forgot referral exclusion → the second domain steals attribution as a self-referral.
  • Different Measurement IDs → the journey lands in two properties.
  • Stripped _gl → redirect or JS navigation drops the linker parameter.
  • iframes → an embedded checkout isn't a link click; that needs a postMessage bridge, not the linker.

Now go practice it

Reading sticks when you do it. These hands-on lessons load your own GTM container and let you debug in Tag Assistant.

Frequently asked questions

What is cross-domain tracking in GA4?

Cross-domain tracking links a user's journey across two or more domains (for example your site and a separate checkout or booking host) so GA4 treats it as one session and one user. Without it, GA4's client id doesn't carry across the boundary, so it starts a new session and the second domain appears as a self-referral.

How do I set up cross-domain tracking in GTM?

Ensure both domains have the GA4 tag with the same Measurement ID, add both domains to the cross-domain settings in the GA4 configuration (Google Tag), add the other domain to GA4's referral exclusions so it isn't counted as a source, then publish and test a full cross-domain journey.

What is the _gl parameter?

_gl is the parameter GA4's cross-domain linker appends to outbound links to the other domain. It carries the client id across, so the second domain adopts the same id and the session continues as one journey. If a redirect or JavaScript navigation strips it, the handoff breaks.

Why is my own checkout domain showing as a traffic source?

That's a self-referral caused by missing cross-domain tracking. The second domain starts a new session and records the first domain as the referrer. Fix it by configuring cross-domain linking for both domains and adding them to GA4's referral exclusions.

Related posts

About the author

Nathan Gage
Nathan Gage

Analytics & Tag Management Consultant

Nathan Gage got his start in marketing through Google Tag Manager. Seeing how tracking customer behavior could turn raw clicks into insight you can actually act on is what pulled him into the field. Since then he has worked both full time and as a consultant with 15 marketing agencies, supporting brands that spend anywhere from a thousand dollars a month to over a million. Along the way he built a multi-touch attribution app, and he created The Happy Tagger so anyone can practice GTM, GA4 and server-side tracking on a real container instead of a production site.