Is your GA4 data actually right? Get a fixed-price GA4 & GTM audit. Request an audit
noxtag
GA4

GA4 cross-domain tracking: setup, testing and why it breaks

In short
  • Cross-domain measurement keeps one visitor as one user when they move between domains you own, by passing their IDs in a _gl URL parameter on links and forms.
  • Set it up in Admin → Data streams → Configure tag settings → Configure your domains, with the same GA4 tag on every domain.
  • Subdomains don't need it, payment providers need unwanted referrals instead, and redirects that drop _gl are the most common reason it breaks.

GA4 cross-domain tracking (Google calls it cross-domain measurement) keeps a visitor as one user in one session when they move between domains you own: your site and a separate booking engine, a shop on another domain, a checkout hosted elsewhere.

Without it, GA4 treats the second domain as a brand-new visitor who arrived from your own site. Your sales get credited to "referral from yoursite.com", and the original Google Ads or newsletter click disappears. Setup takes five minutes. Making it actually work is mostly about avoiding a few predictable breakages.

What cross-domain measurement fixes

GA4 identifies a browser with first-party cookies, and cookies belong to one domain. Google's documentation puts it simply: without cross-domain measurement, new cookies with new IDs are created for each domain a user visits.

One visitor, two domains: what changes when cross-domain is on
One visitor, two domains: what changes when cross-domain is on

The symptoms of a missing setup are easy to spot once you know them:

  • Self-referrals: your own domain appears as a referral source in Traffic acquisition.
  • Conversions credited to the wrong place: purchases on the second domain show "referral" instead of the ad or email that brought the visitor.
  • Inflated users: every visitor who crosses over is counted twice.
Free download · PDF

The 40-point GA4 audit worksheet

Every check in a printable worksheet, with where to look in GA4 and a priority for each one.

You'll also get the noxtag newsletter: one practical tracking fix every two weeks. Unsubscribe anytime.

How the _gl linker works

When cross-domain is configured, the Google tag watches for clicks on links and form submissions that point to another configured domain. It appends a _gl parameter to that URL, carrying the visitor's IDs. On the destination, the Google tag reads _gl and writes the same IDs into its own cookies. Google's developer docs describe it as sharing first-party measurement cookies between domains through that linker parameter.

The visitor's IDs ride across in the _gl parameter, then get written to the new domain's cookies
The visitor's IDs ride across in the _gl parameter, then get written to the new domain's cookies

Two things follow from this, and they explain most problems later:

  1. It only works for links and forms. Navigation done in JavaScript (window.location = …) isn't decorated automatically.
  2. The _gl parameter must survive the trip. Anything that strips query parameters on the way (a redirect, a URL normaliser) breaks the chain.

Do you need cross-domain, unwanted referrals, or nothing?

Cross-domain is often configured where it isn't needed and missed where it is. Use this decision guide first:

Pick the right fix for your setup
Pick the right fix for your setup
  • Subdomains of the same site (shop.site.com and www.site.com): nothing to do. GA4 cookies are set on the top-level domain by default, so they're shared automatically.
  • A second domain you own and can tag (site.com → site-booking.com): cross-domain measurement.
  • A payment provider you return from (PayPal, Stripe, Adyen): you can't put your tag on their pages, so list them as unwanted referrals instead. That stops the return trip from starting a new session.
  • A booking or checkout widget in an iframe: the linker doesn't reach inside iframes. You'll need a manual handoff of the client ID, usually with the widget vendor's help.
  • Two brands with separate GA4 properties: neither. Keep them apart, since IDs can't be shared across properties anyway.

How to set up cross-domain measurement

Four steps in the GA4 interface, no code changes needed
Four steps in the GA4 interface, no code changes needed
  1. Tag every domain with the same GA4 property. The same measurement ID must run on each domain in the journey, whether through GTM or gtag.js.
  2. Open the tag settings. Admin → Data streams → choose your web stream → Configure tag settings.
  3. Configure your domains. Add a condition for each domain (for example contains site-booking.com). Conditions use OR logic, so list each domain once. Save.
  4. Test the handoff, as described below.

If you use GTM, you don't need to change your Google tag: the setting lives in the GA4 interface and applies to the Google tag wherever it runs. Google recommends this interface setup over manual configuration.

How to test that it works

Don't trust the setting until you've watched it work:

  1. Open a page on domain A and click a real link to domain B (not a typed URL).
  2. Check the destination URL: it should contain ?_gl=1~….
  3. In DevTools → Application → Cookies, compare the _ga cookie on both domains. The client ID (the two numbers at the end of the value) should be identical.
  4. In GA4 DebugView (or GTM Preview), confirm the events on domain B belong to the same session as domain A. Our DebugView guide covers how to get debug mode running.
  5. A week later, check Traffic acquisition: your own domain should have disappeared as a referral source.

Quick test without DevTools: if the _gl parameter is in the URL when you land on domain B, the sending side works. If it's there but users still double up, the problem is on the receiving side (tag missing, consent denied, or a different property).

Is your GA4 & GTM setup collecting the right data?

Get a senior review of your tags, triggers, data layer and consent setup, with a prioritized fix list your developers can act on.

Fixed price · Read-only access · Reply within 1 business day

Why cross-domain stops working

Six breakages we find most often
Six breakages we find most often
  1. A redirect drops _gl. Domain B redirects /book to /book/ or to a language version and loses the query string. Google's guidance is to preserve the _gl parameter in redirects.
  2. JavaScript navigation. Buttons that send people across with window.location instead of a link aren't decorated. Turn them into real links, or decorate the URL manually.
  3. Click handlers block the listener. The linker listens for clicks at the document level. A script that stops event propagation on a link (some sliders, modals and SPA routers do) prevents decoration.
  4. Different GA4 properties. Cross-domain only joins domains that send to the same property.
  5. A custom cookie prefix or name on one side. The linker expects the default _ga cookies.
  6. Consent denied on domain B. If analytics consent isn't granted on the destination, no cookie gets written, so there's nothing to keep. Make sure your consent banner shares the choice across domains, or asks again.

Further reading: GA4 Unassigned traffic: what it means and how to fix it. Broken cross-domain setups are a common source of self-referrals and misattributed sessions.

Frequently asked questions

What is cross-domain tracking in GA4?

It's a setting that keeps a visitor as the same user and session when they move between domains you own. The Google tag adds a _gl parameter to links and forms between configured domains, and the destination reads it to reuse the same IDs.

Do I need cross-domain tracking for subdomains in GA4?

No. GA4 sets its cookies on the top-level domain by default, so subdomains like shop.example.com and www.example.com already share the same user. Cross-domain measurement is only needed for different domains.

Should PayPal or Stripe be added to cross-domain measurement?

No. You can't run your tag on a payment provider's pages, so add them to the unwanted referrals list instead. That keeps the visitor's return from payment in the original session.

How do I check if GA4 cross-domain tracking is working?

Click a link from one domain to the other and check that the URL contains a _gl parameter, then compare the _ga cookie value on both domains: it should be identical. In reports, your own domain should stop appearing as a referral source.

Usually the destination domain isn't listed in Configure your domains, the navigation uses JavaScript instead of a link, or a script stops click events from reaching the Google tag's listener. Check the domain conditions first, then the link itself.

One journey, one user

Cross-domain measurement is a small setting with a large effect on attribution: it decides whether your bookings and purchases are credited to the campaigns that drove them or to your own website. Set it up, test it with a real click, and re-test after any change to the second domain's redirects or consent banner.

If your journey spans several domains, a booking engine or an embedded checkout, our GA4 & GTM audit traces the full path, including the parts that need a manual handoff.

noxtag is a small, senior tracking-implementation practice. We write these guides from real GA4 and GTM audits. More about us.

One tracking fix every two weeks

Short, practical GA4 and GTM fixes from real audits. No fluff, unsubscribe anytime.

We store your email only to send the newsletter. See our privacy policy.