Attribution

Short answer: GA4 cross-domain tracking keeps one user and session across sites you control. Use the same web data stream on all of them, list every domain under Configure your domains in the tag settings, then test that links carry the _gl parameter. Most failures come from redirects, JavaScript navigation, iframes, consent settings or a different measurement ID.

GA4 cross-domain tracking: setup, testing and the common errors, cover

A customer clicks your Google ad, lands on your marketing site, then moves to a separate domain to book a demo or pay. Without cross-domain measurement, GA4 can treat that person as two users, start a new session and credit the conversion to your own site as a referral. Your paid campaign then looks worse than it really is, and your attribution reports become unreliable. The setup takes minutes, but the errors around it take much longer to find. This guide covers when you need it, how to set it up, how to test it properly and how to fix the common failures. Google's [cross-domain measurement help page](https://support.google.com/analytics/answer/10071811) is the reference for the current interface.

When do you need GA4 cross-domain tracking?

You need it when users move between separate registrable domains that you control and can tag, such as:

  • A marketing site on brand.com and a store or app on brandstore.com.
  • A country site on brand.in and checkout on brand-pay.com.
  • A marketing site and a separately hosted web application on another domain.

You usually do not need it for:

  • Subdomains of one domain. With default cookie settings, GA4 sets its cookie at the top-level domain, so www.brand.com and app.brand.com share it.
  • Sites you cannot tag. Hosted payment pages, like many gateway checkouts, cannot run your Google tag. Cross-domain will not help, as there is nothing on the other side to read the parameter. Use unwanted referrals so that the return visit does not restart attribution, and consider sending the purchase through a server-side event.
  • Unrelated businesses. Sites with different audiences often deserve separate properties.

If your only issue is Shopify checkout, see our article on GA4 and Shopify sales mismatches, as Shopify's own setup has its own rules.

You can see what you spent. Not what it earned. Where tracking signal gets lost between the ad click and revenue, and how to connect both so budget decisions come from one report. 44 seconds. Narrated with an AI voice. Charts shown are illustrative. See marketing attribution
Read the transcript

You can see what you spent. Not what it earned. If tracking stops at the form, you are setting budgets without the revenue data.

Ad platforms and your CRM disagree. Signal is lost at every step of the journey. So budget follows whichever report is loudest.

Connect the ad click to the closed deal.

Tracked from the ad click to closed revenue. Each stage keeps its source and click ID. Budget decisions come from one trusted report.

Marketing attribution, with Rahul D Sarker. Book a call at rahuldsarker.co.

How does GA4 cross-domain tracking work?

GA4 identifies a browser through its first-party _ga cookie, which holds the client ID. Browsers do not share first-party cookies between different domains, so a second domain cannot normally see the first domain's ID and creates a new one.

Cross-domain measurement solves this with a linker. When a user clicks a link to a configured domain, or submits a form to it, the Google tag adds a _gl parameter to the destination URL. It contains encoded client and session information. If the destination page runs a Google tag for the same setup, it reads that value and continues the same user and session.

Two things follow from that:

  1. The parameter must survive the journey. Redirects or scripts that strip the query string will break it.
  2. The linker decorates clicks and form submits it can detect. JavaScript navigation may be missed, as a page that sets window.location in code does not go through a normal link click.

The _gl value has a short lifespan by design, so copied or bookmarked links with old parameters do not continue a session. Most tracking problems here turn out to be a failure of one of those two conditions.

How do you set up GA4 cross-domain tracking?

The steps below assume the Google tag is already installed on all the domains.

  1. Use one GA4 property and the same web data stream. All domains should send to the same measurement ID. If you want separate reporting for each domain, use a hostname filter or comparison, not a separate stream, for this journey.
  2. Open tag settings. In GA4, go to Admin, then Data streams, choose your web stream, open Configure tag settings, and then Configure your domains.
  3. Add each domain. Use a "contains" match with the root domain, such as brand.com and brandstore.com. Add both directions by listing all domains. Save.
  4. Check tag installation on each domain. Google Tag Manager containers and hard-coded tags both work, but check that one page does not fire two conflicting tags. A GTM audit is a quick way to find duplicates.
  5. List unwanted referrals where necessary. In the same tag settings area, add third-party domains, such as payment gateways, that send users back to you and should not restart the source.
  6. Add a hostname view. Add the Hostname dimension in explorations or standard reports, so that you can see each domain's traffic, as the page path alone may look identical.

No code changes are normally needed if you use a standard Google tag with normal links.

How do you test GA4 cross-domain tracking?

Do not assume success just because the settings are saved. Test as a user would, starting in a fresh incognito window.

  1. Click, do not type. Start on domain A and click a real link to domain B. Typing the URL will never carry the parameter.
  2. Check the URL. After you arrive on domain B, the address should contain _gl=. The site may remove it quickly, so look immediately, or watch the network log with preserved logs.
  3. Compare client IDs. Open developer tools on each domain and look at the _ga cookie. The last two number groups should match. This is the clearest test.
  4. Use Tag Assistant. Connect Google's Tag Assistant to both domains and follow the journey.
  5. Check DebugView. In GA4 Admin, open DebugView and confirm that the events continue under the same device stream.
  6. Check reports later. After a day or two, look at Session source / medium for your own domain. Self-referrals should fall away. Check conversions for the source you expect. Historical data will not be corrected, so note the date of the change.

Test on mobile Safari and with your consent banner in the actual state users will see. Test each important route: nav links, buttons, forms and the back journey.

Why is GA4 cross-domain tracking not working?

The table lists the most common failures. Work through them in order, because several may occur together.

Cross-domain tracking problems
SymptomLikely causeFix
No _gl in the URLDomain not listed, or tag missing on the first pageCheck Configure your domains and confirm the tag is firing before the click
_gl appears, then the session still splitsA redirect strips it, or the destination uses another streamTrace redirects so they keep the query string, and align the measurement ID
Works on links, not on buttonsNavigation runs through JavaScriptUse a real link where possible, or build the linker into the code using the gtag API
Booking widget or form loses the userIt runs in an iframe from another domainPass the linker into the iframe URL, or measure conversion with a postMessage event to the parent page
Your own domain shows as a referralA broken link journey, or a third-party returnFix the linker, and add unwanted referrals for third-party domains
Client IDs differ only in some browsersConsent refusal or storage restrictionsCheck consent settings, and url_passthrough where relevant, with your privacy adviser
Inflated page views or duplicate eventsTwo tags or two GTM containers firingRemove the duplicate, then retest
Internal traffic looks like a new sessionSession timeout, or a different stream on one page templateCheck every template, including thank-you and error pages

Redirects, consent and iframes in more depth

Redirects. Many sites redirect through www, a country path or a tracking domain. Check each hop with your browser's network panel, as one server rule that drops query strings is enough to break the journey. Vanity links and link shorteners are frequent offenders.

Consent. If a user refuses analytics cookies, GA4 cannot store the same client ID in the normal way. Under Consent Mode, tags change behaviour according to the user's choice, and the outcome depends on your settings. Our article on Consent Mode v2 and DPDP covers this. Do not bypass a user's refusal in order to preserve attribution.

Iframes. Booking tools, payment forms and embedded lead forms often sit in iframes. The linker does not automatically pass into them. Where the vendor supports it, you can append the linker parameter to the iframe's URL with custom code. A simpler and often better route is for the iframe to send a message to the parent page when a booking is complete, and for the parent page to send the GA4 event. Then attribution stays with the session on your domain.

Server-side tagging. If you use a server container, check that it passes the client ID consistently. Our GTM, GA4, CRM and Looker stack article shows how these components connect.

Keep attribution working beyond GA4

Fixing GA4 does not automatically fix Google Ads, Meta or your CRM. Check these as well:

  • Google Ads. The GCLID must survive the domain change for conversion tags on the second domain. In Google Tag Manager, the Conversion Linker tag has its own linker settings for cross-domain journeys. Enable them with the same domains.
  • Meta. Pixel and Conversions API identifiers such as fbp and fbc can differ across domains. Meta's event matching can help, but it needs clean customer data. See event match quality.
  • Your CRM. If forms pass the GA4 client ID and UTM values to CRM records, test that this still works on the second domain.
  • UTMs on internal links. Never use UTM tags on links between your own domains. They overwrite the original source and start a new session. This is one of the most common ways that a good setup gets damaged.
  • Reports and audiences. Check exclusions and audiences that rely on hostname.

Once this is working, document it: domains, tag IDs, the test steps and who owns them. Then schedule a recheck whenever a site redesign, a checkout change or a new booking tool goes live. A GA4 audit can do this for you if you want a second pair of eyes.

FAQ

Usually no. With default settings, GA4 cookies work across subdomains of the same root domain. You may still want the Hostname dimension in reports, to see which subdomain each page view came from.

Not with the linker, because you cannot run your tag there. Add the provider as an unwanted referral so the return does not take credit, and send the purchase from your thank-you page or server where possible.

No. GA4 does not restate historic sessions after you change this setting. Note the date in your reports, and compare before and after with that in mind.

It is an encoded value that carries identifiers and a timestamp. It is expected, and it should not break pages. If your site errors on unknown parameters, fix that behaviour, or the journey will fail.

Read this article on your favourite platform

Ready to build the system?

If this describes your funnel, a 30-minute call will find where the constraint sits in your own numbers and what it would take to fix it.

It starts with a 30-minute call. Pick a time below.

Prefer email?