TROUBLESHOOTING 8 min read

One Journey, Two Sessions: How Cross-Domain Tracking Quietly Breaks

LastClarity

The short answer

GA4 links domains by appending a _gl linker parameter to outbound links. If a redirect, an SPA router or a URL rewrite strips it, the second domain mints a new client ID, the session splits, and the conversion is credited to direct instead of the original channel.

The customer journey looks like this: they read a blog post on your marketing site, click through to your checkout on a different domain, and buy.

GA4 reports two visitors. One who read a blog post and left. One who appeared from nowhere and immediately bought. The purchase gets credited to direct, and the campaign that actually produced it shows a cost with no return.

Nothing errored. This is the failure mode: it is completely silent.

The mechanism, and where it fails

GA4 stores its client identifier in a first-party cookie, which by definition cannot be read by a different domain. So the Google tag passes the identity in the URL.

When someone clicks a link to a domain you have listed, the tag appends a _gl parameter carrying the client ID and session context. The tag on the receiving domain reads it and continues the same session.

Every failure is the same failure: _gl did not survive the trip.

  • Servers that strip unknown query parameters — a common security hardening rule
  • URL rewrite rules that rebuild the URL and drop what they do not recognise
  • Single-page app routers that reconstruct the URL on navigation
  • Link-decorating scripts that run after the Google tag and overwrite the href
  • Redirect chains where one hop discards the query string

When _gl is missing, the second domain has no identity to continue. It mints a new client ID, starts a new session, and — because the referrer is your own other domain, or nothing at all — attributes it to direct or to a self-referral.

This is reported in roughly 60% of ecommerce and SaaS audits. It is closer to the default state than to an edge case.

Testing it takes ten seconds

Click a link from one domain to the other and look at the address bar.

https://checkout.example.com/cart?_gl=1*1abcde*_ga*NTk...
                                  ^^^ this

_gl present means the link was decorated. Missing means it was not, and every journey across that link is splitting. For a second confirmation, run GA4 DebugView on both domains and check the session ID continues.

Setting it up correctly

Two requirements, and the first is the one people get wrong:

1. One data stream, one measurement ID, on every domain. Not one stream per domain. Separate streams cannot share a session by design, so no amount of domain configuration will fix a two-stream setup.

2. List every domain: Admin → Data streams → your stream → Configure tag settings → Configure your domains.

SituationCross-domain config needed?
www.example.comshop.example.comNo — subdomains share cookies
example.comexample-shop.comYes
example.comcheckout.stripe.comNo — use the unwanted referrals list
example.comapp.example.ioYes — different registrable domain
Two brands, one GA4 propertyYes

Subdomains are the common source of wasted effort. They already share cookies. Configuring them changes nothing.

Cross-domain tracking is not a setting you switch on once. It is a dependency between your tagging and every piece of infrastructure that touches a URL — redirects, rewrites, routers, CDN rules. Any of those can break it, none of them know it exists, and nothing will tell you when it happens.

Why it breaks again after you fix it

The setup survives until someone changes something adjacent to it. Redesigns, CMS migrations, framework upgrades, a new CDN rule, a vendor swap, or a new subdomain nobody added to the list.

Because the failure is silent, the usual discovery path is an unexplained rise in direct traffic weeks later, followed by an afternoon of confusion.

Two habits that catch it early:

  • Re-run the ten-second _gl check after any deployment that touches routing, redirects or the checkout flow.
  • Watch direct traffic as a share over time. A step change in direct that coincides with a release is this bug until proven otherwise.

The monitoring half

Diagnosis and repair here are entirely GA4 and GTM work — our extension writes no tags and cannot decorate a link.

Where GA4 Simple View helps is the second habit. Direct traffic sitting at 15% for months and then jumping to 30% is the signature of a broken link, and with the previous-period comparison on the Traffic tab that shift is visible the same week rather than at the next quarterly review. For teams running several properties, the multi-site view makes the same check cheap across all of them.

Everything else in this post you can do for free, in GA4 and your browser’s address bar.

Questions people also ask

Each answer stands on its own, so it still makes sense quoted somewhere else.

How does GA4 cross-domain tracking actually work?

When a visitor clicks a link to a domain you have configured, the Google tag appends a _gl parameter carrying the client ID and session context. The tag on the receiving domain reads that parameter and continues the same session instead of starting a new one. If the parameter does not arrive, there is nothing to continue.

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

Serve the same measurement ID from one web data stream on every domain, then go to Admin, Data streams, select the stream, Configure tag settings, and Configure your domains. List every domain in the journey. Using separate data streams per domain defeats the mechanism entirely.

Why does the _gl parameter disappear?

Common causes are server rules that strip unknown query parameters for security, URL rewrite rules, single-page app routers that rebuild the URL on navigation, link-decorating scripts that run after the Google tag, and redirect chains that drop the query string on one of the hops.

How do I test whether cross-domain tracking is working?

Click through from one domain to the other and look at the destination URL. If cross-domain tracking is working you will see a _gl parameter appended. If it is missing, the link is not being decorated. Confirm in GA4 DebugView that the same session ID continues across both domains.

Does cross-domain tracking break after a redesign?

Frequently. Setups break after redesigns, CMS migrations, framework upgrades, vendor changes and whenever a new subdomain is added without being listed. Because nothing errors, the breakage is silent and usually surfaces later as an unexplained rise in direct traffic.

Do subdomains need cross-domain configuration?

No. Subdomains of the same domain share cookies by default, so shop.example.com and www.example.com already share sessions with no configuration. Cross-domain setup is only needed when the registrable domain itself changes, such as example.com to example-shop.com.

#Cross-domain#GA4#GTM#Attribution#Ecommerce

This is what we built instead

GA4 Simple View puts the numbers in this post on one screen, in one click, without building a report first.

Get the extension