Skip to content
accs-net.com

Press Esc to close

Cross-Domain Tracking

Cross-domain tracking keeps one visitor as one user and one session in Google Analytics 4 when they move between two different domains, for example from shop.example.com to checkout.example.net.

The Google tag does this with a _gl parameter that it adds to links between the domains you list, so the next site can read the visitor’s client ID from the URL.

Seeing ?_gl= in a URL? That is the linker parameter of the Google tag, and it carries Google Analytics cookie values to the next page. Google says it expires after two minutes, so removing it from a link you share does no harm.

GA4 cross-domain tracking with the _gl parameter passing the client ID between two domains
The _gl parameter carries the client ID from one domain to the next, so GA4 keeps both pageviews in one session

What the _gl Parameter in a URL Means

Browsers keep cookies separate for each domain, so checkout.example.net cannot read the _ga first-party cookie set on shop.example.com.

Without help, the second domain creates a new client ID. GA4 then counts a second user, starts a new session and reports the first domain as a referral.

The linker fixes this at the moment of the click. It copies the cookie values into _gl, and the tag on the next domain writes them into its own cookies.

Google’s cross-domain guide for the Google tag states that linker parameters expire after two minutes. That is why the tag adds _gl only when a link is clicked.

The link in your HTML stays clean until that click. In the test described below, the href read before the click had no _gl, and the address after the click carried it.

Why _gl shows up on your site

If you never set up cross-domain tracking and still see _gl, one of four sources added it:

Source When it adds _gl Where to look
Your cross-domain list Clicks on links to another domain in the list GA4 Admin, Configure your domains
Consent mode with URL passthrough Clicks on internal links while the visitor refuses cookies Your cookie banner or the url_passthrough setting
Conversion Linker tag in GTM Clicks on links to domains in Auto Link Domains The tag’s Enable linking across domains option
Another site Visits from a partner or payment page that lists your domain Nothing on your side, the tag only reads it

The second source surprises most site owners. Google’s consent mode guide lists _gl among the parameters URL passthrough appends to links, next to gclid.

On a test page with consent set to denied and URL passthrough on, a click on an internal link produced this address on the same domain, with no ad click involved:

https://shop.example.com/p2?_gl=1*1gdljyb*_up*MQ..*_ga*MjAwMDU5MjAyLjE3OTM4MDg4MzE.*_ga_ABCDE12345*czE3OTM4MDg4MzEkbzEkZzAkdDE3OTM4MDg4MzEkajYwJGwwJGgw

In that mode the tag wrote no cookies at all, so it passed its values through the URL from page to page instead.

Can you remove _gl from your URLs?

From links you copy, share or bookmark, yes. A stale value is ignored, and the visitor simply starts a new session.

Do not strip it with redirects or server rules on a domain that should receive it. The tag reads _gl when the page loads, so a redirect that drops the query string breaks the handoff.

How to Read a _gl Value

Google does not document the format of _gl. The breakdown below comes from a live capture: on 4 November 2026 I ran the current Google tag on two test domains and clicked a link between them.

https://checkout.example.net/cart?_gl=1*6skd2t*_ga*MTAyMjgzMDgxLjE3OTM4MDg0MjQ.*_ga_ABCDE12345*czE3OTM4MDg0MjQkbzEkZzAkdDE3OTM4MDg0MjQkajYwJGwwJGgw

The value is a chain of parts joined by asterisks. After the version and a check value, each pair is a cookie name followed by its value in Base64:

Part Value in the capture What it is
Version 1 Format of the linker string
Check value 6skd2t Short code tied to the browser and the time of the click
_ga MTAyMjgzMDgxLjE3OTM4MDg0MjQ. Decodes to 102283081.1793808424, the client ID from the _ga cookie
_ga_ABCDE12345 czE3OTM4MDg0MjQk… Session cookie of the stream with measurement ID G-ABCDE12345
_up MQ.. Decodes to 1, appeared only with URL passthrough

The client ID has two halves. The second one, 1793808424, is a Unix timestamp of the moment the cookie was created, 4 November 2026 at 16:07 UTC.

The session part decodes to a string of short fields:

s1793808424$o1$g0$t1793808424$j60$l0$h0

Here s is the session ID, o the session number, g the engaged flag and t the time of the last hit.

Base64 is an encoding, not encryption. Anyone who sees a decorated link can read the client ID, which is one more reason to strip _gl from links you post publicly.

To read a value of your own, paste the address into the _gl parameter decoder. It splits the string, decodes each cookie and checks whether the link still works in your browser.

The check value ties _gl to one browser and a short time window. To see the limit in practice, I opened the same decorated link in fresh browser profiles at different delays:

Opened after Browser Result on the second domain
5 seconds Same user agent Same client ID
8 seconds Different user agent New client ID
55 to 140 seconds Same user agent Same client ID
200 seconds Same user agent New client ID
330 seconds Same user agent New client ID

Google’s two-minute figure is a fair rule of thumb: the link still worked at 140 seconds and failed at 200. Test with fresh clicks, never with links pasted into another browser.

How to Set Up Cross-Domain Tracking in GA4

You need the Editor role or higher on the Google Analytics account. The steps follow Google’s set up cross-domain measurement article:

  1. In Admin, under Data collection and modification, click Data streams, then Web, and open your web stream.
  2. At the bottom of the stream details, click Configure tag settings.
  3. In the Settings section, click Configure your domains.
  4. Click Add condition, choose a match type and enter each domain, such as example.com and example.net. Conditions use OR logic.
  5. Click Save, then test a click between the domains as described below.

Every domain in the list needs the same Google tag on every page. A domain without the tag receives _gl but has nothing to read it.

Linker Settings: Name, Type, Required, Default

The Admin setting covers most sites. If you configure the tag in code, these are the four linker fields Google documents:

Name Type Required Default
domains Array of domains Yes None
accept_incoming Boolean No True when domains has a value
decorate_forms Boolean No False
url_position String, query or fragment No Query

The defaults matter on the receiving side. In the test, a page whose tag had no linker settings ignored an incoming _gl and created a new client ID.

Forms behave the same way. A form that submits to another domain got _gl only with decorate_forms set to true.

Code for gtag.js and Google Tag Manager

With gtag.js on the page, Google’s documented setup places the linker before the config command:

<script async src="https://www.googletagmanager.com/gtag/js?id=TAG_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('set', 'linker', {'domains': ['example.com', 'example.net']});
  gtag('js', new Date());
  gtag('config', 'TAG_ID');
</script>

In Google Tag Manager, open your Google tag, add a configuration parameter named linker and enter the linker object as its value:

{'domains': ['example.com', 'example.net']}

Google notes that this parameter overrides the domains set in GA4 Admin, and it recommends the Admin interface for most cases.

For Google Ads, the Conversion Linker tag has its own switch, Enable linking across domains, plus an Auto Link Domains field.

Cross-Domain, Subdomain or Cross-Device?

Case Example What keeps one user
Cross-domain shop.example.com to checkout.example.net The _gl linker
Subdomains blog.example.com to shop.example.com One shared cookie, no setup needed
Cross-device Phone to laptop User-ID or Google Signals

Subdomains work by default because Google tags set cookies on the highest level of domain possible. Problems start when one of them sets a different cookie domain, which Google lists as a cause of self-referrals.

Cross-Domain Tracking Not Working: Symptoms and Checks

Symptom Likely cause How to check
No _gl on the second domain Domain missing from the list, or the visitor left through JavaScript Compare the list with the link. Navigation by script is not decorated.
_gl in the first request, gone on the landing page A redirect dropped the query string DevTools, Network tab, the request before the redirect
_gl arrives, client ID still changes No linker settings on the receiving tag, or the link is stale Compare the _ga cookie on both domains
No _ga cookie on the second domain The visitor refused analytics cookies there Accept cookies on both domains before testing
Payment provider shows as a referral The visitor came back without _gl Add the provider under List unwanted referrals

About the last row: Google’s unwanted referrals article says GA4 skips the referral only when the page contains _gl from a listed domain. List unwanted referrals sits under Configure tag settings, Show all.

To walk through tracking symptoms one by one, the Fix My Tracking checker has a section for cross-domain issues.

How to Check That It Works

  1. Clear cookies for both domains, open the first one and click a link to the second.
  2. Look at the address bar on the second domain. It should contain _gl=1*.
  3. In Chrome DevTools, open Application, then Cookies, and compare _ga on both domains. The client ID after the GA1.1 prefix must be the same.
  4. Turn on debug mode with Tag Assistant or debug_mode, then open Admin, Data display, DebugView. The hop should not start a new session.

In the test, the page_view event on the second domain carried the same session ID as the first page and no session start flag.

Cross-Domain Setup Checklist

  1. All domains are in Configure your domains on the stream that tags them.
  2. Every page on every domain loads the same Google tag.
  3. Redirects on the receiving domain keep the query string.
  4. Payment and login providers you return from are in List unwanted referrals.
  5. Subdomains share one cookie domain, which the default setting already does.
  6. A test click shows _gl, the same _ga value on both domains and one session in DebugView.

Cross-domain tracking in GA4 answers one specific case: the same browser moving between domains you own. Subdomains, links to other people’s sites and server-side events need none of it.

Frequently Asked Questions

What is the _gl parameter in a URL?

It is the linker parameter of the Google tag. It carries Google Analytics cookie values, such as the client ID and the session, from one domain to the next so GA4 keeps one user and one session.

Can I remove _gl from my URLs?

From links you share or bookmark, yes. Don’t strip it with redirects on a domain that should receive it, because the tag reads the value when the page loads.

Why does _gl appear on a site with only one domain?

Usually because of consent mode with URL passthrough. While a visitor refuses cookies, the tag carries its values through internal links instead.

How long is the _gl parameter valid?

Google says linker parameters expire after two minutes. In a test, a link opened after 140 seconds still worked and one opened after 200 seconds did not.

Do I need cross-domain tracking for subdomains?

No, as long as the subdomains share one cookie domain. Google tags set cookies on the highest level of domain possible by default.

Why does my checkout domain still show up as a referral?

GA4 skips the referral only when the visitor arrives with _gl from a listed domain. Returns from payment providers usually come without it, so add those domains to List unwanted referrals.

Is _gl the same as the gl parameter in Google search?

No. In Google search, gl without the underscore is a two-letter country code that sets the searcher’s location. The _gl parameter belongs to Google Analytics and the Google tag.

  • Client ID: the browser identifier that _gl carries between domains
  • First-party cookie: the cookie scope that makes the linker necessary
  • Session: the visit that cross-domain tracking keeps in one piece
  • Referrer: the source that turns into a self-referral when the handoff fails
  • Data stream: the place in GA4 Admin where the domain list lives
  • GCLID: the Google Ads click ID that URL passthrough also carries
  • Cross-device tracking: joining one person across phone and laptop
  • Measurement Protocol: the server-side route where the linker plays no part

Tom Martin
Written by

Tom Martin

Web analytics specialist with deep expertise in Google Analytics, Tag Manager, and e-commerce tracking. Helping businesses understand their data without the noise — practical guides, honest reviews, and real-world implementation experience.