Home / Guides

Cross-domain tracking that stops at the border

The visitor clicks from your shop to your checkout domain and arrives as a stranger: a new client id, a new session, and the shop listed as the referrer. Everything that went wrong is in one URL parameter, and most of it can be read.

The report shows it before anyone notices. Sessions that start on the checkout domain with the shop as their referrer. Purchases attributed to Referral from your own site. Twice as many users as there should be, because each person is counted once on each side of the border.

All of it comes down to one parameter, _gl, and whether it survived the trip.

What the handoff needs

Google’s setup is short. In the GA4 web stream, under Configure tag settings → Configure your domains, list every domain the journey crosses. Both sides must load the same G- tag ID from that one stream. From then on, when a visitor follows a link or submits a form to a listed domain, the Google tag adds _gl to the destination URL, and the tag on the other side reads it and keeps the same user and session instead of making new ones.

What travels in it is cookies, base64-encoded behind their names: _ga (the client id), _ga_<stream> (the GA4 session) and, where they exist, the Google Ads click cookies. The _gl decoder reads one in plain words.

Where it gets lost

Google names three ways, and between them they cover most broken setups:

Google also warns about self-referrals, subdomains especially: a page on the journey without the tag, or a cookie domain set too narrowly, and the session restarts with your own domain as the source.

The most common false alarm is the test itself. A _gl link carries a hash of the browser that made it (user agent, timezone, language and the minute), and the Google tag accepts it only there, for about two minutes. Copy the decorated URL into another browser, or open it the next morning, and the tag ignores it, correctly. That is measured, not documented, but it is why a link pasted into a ticket “does not work”.

Checking it from the requests

  1. On the first domain, open DevTools or the extension and note the cid on any GA4 hit.
  2. Click the link: a real click, same browser.
  3. Read the destination URL: is _gl there? If not, stop here: the handoff never left.
  4. Read the first GA4 hit on the second domain. The same cid means the handoff worked. A new one means _gl arrived and was refused, or was stripped by a redirect before the tag ran.
  5. Check the referrer on that hit (dr). Your own first domain there is the self-referral GA4 will report.

The redirect case shows in step 3 as a URL without _gl after one with it. The campaign guide has the same problem with utm parameters, and the same fix.

Seeing it in Tag Master

The audit follows the visitor across the border. When the domain changes during a journey and the client id changes with it, it says the visitor was lost there. Since 2.0.2 it also decodes the _gl that arrived and lists what it carried; a link that was pasted or arrived stale is a note, not an error, because the Google tag was right to refuse it.

Questions

Why is GA4 cross-domain tracking not working?

Usually the _gl parameter never reached the second domain: a redirect dropped it, the link was followed by script rather than a click, or a click handler stopped the event before the Google tag saw it. Less often both domains are not on the same G- ID in the same web stream. Each one is visible in the destination URL and the first hit there.

How do I test cross-domain tracking?

Click the link on the first domain in the same browser, and check that the destination URL carries _gl and that the first GA4 hit there has the same cid as the hits on the first domain. Copying the link into another browser does not test anything: the Google tag refuses a _gl made elsewhere.

How long is a _gl link valid?

Google does not document it. Measured against the Google tag, a link is accepted in the browser that made it for about two minutes and refused after that, and refused at once in any other browser: its hash includes the browser’s user agent, timezone, language and the minute.

Where do I set up cross-domain measurement in GA4?

Admin → Data collection and modification → Data streams → your web stream → Configure tag settings → Configure your domains. List every domain the journey crosses; both need the same G- tag ID from that stream.

The rest of this group: GA4, server-side and attribution

More in GA4, server-side and attribution

Try it on your own site

Tag Master is free, needs no account, and collects no data.

Add to Chrome, it’s free