Skip to content

Web and product analytics

How to set up cross-domain tracking in GA4

By the editors of Analytics1.comLast reviewed 19 October 20262 min read

The short answer

Use the same GA4 measurement ID on every domain, then go to Admin, Data streams, your web stream, Configure tag settings, Configure your domains, and list each domain. GA4 then adds a _gl parameter to links and forms between them so the visitor keeps one user and session. Test by clicking across and checking _gl appears in the destination URL.

On this page 6 sections
  1. When you need it
  2. Step by step
  3. What breaks it
  4. Unwanted referrals
  5. Questions
  6. Sources

When you need it

Cross-domain measurement is for one journey spread over separate registrable domains: a marketing site on example.com with booking on examplebookings.com, or a shop that hands checkout to a different domain. Without it, the second domain sees a new visitor arriving as a referral from the first, and every booking is credited to your own website rather than to the ad that started it. Subdomains of one domain (www.example.com and shop.example.com) share cookies by default and usually need no cross-domain set-up.

Step by step

  1. Make sure every domain's pages carry the same Google tag with the same G- measurement ID from the same web data stream.
  2. In GA4 go to Admin, Data collection and modification, Data streams, Web, and select the stream.
  3. Click Configure tag settings, then under Settings choose Configure your domains.
  4. Accept any domains GA4 suggests under Recommendations, or click Add condition, pick a match type (contains, exactly matches and so on), enter the domain and Save. Conditions use OR logic, and you can add up to 100.
  5. Test: on domain A, click a link to domain B. The landing URL should contain ?_gl=1*... and the page should load normally. Also test that file downloads still start.
  6. In DebugView, confirm the session continues on domain B rather than starting a new one.

What breaks it

  • Redirects that drop query parameters. If domain B redirects and strips ?_gl, the link is lost. Ask developers to preserve query strings.
  • JavaScript navigation. If a script moves the visitor (window.location) instead of a click on a real link or form, GA4 may not decorate the URL.
  • Scripts calling stopPropagation() on clicks can stop the parameter being added.
  • Consent. Cookies are only set where there is consent, so declined visitors cannot be joined across domains.
  • Payment providers. A hosted payment page on a third-party domain is not yours to tag; list it as an unwanted referral instead so the return visit is not credited to the provider.

Unwanted referrals

If your own domain or a payment provider still appears as a referral source, add it under Configure tag settings, List unwanted referrals. That stops a new session being credited to it, but it does not join users across domains; only cross-domain measurement does that.

Once the journey is joined, check that campaign tags survive the hop: UTM parameters explained and the UTM builder.

Questions

Do I need cross-domain tracking for subdomains in GA4?
Usually not. Subdomains of the same domain share first-party cookies by default. If self-referrals appear between subdomains, Google recommends making sure every subdomain uses the same cookie domain and the same tag, and adding them to the domain list.
What is the _gl parameter in a URL?
_gl is the linker parameter GA4 appends to links and forms between domains you have listed, carrying the visitor's user and session identifiers so the destination domain continues the same session.

Sources

Next step

Try the utm builder

Related guides