GA4 Cross-Domain Tracking: One Journey Across Two Sites
If your website, shop, booking system or member area live on different domains, GA4 counts one visit as two unless you join them. This guide covers how cross-domain measurement works, how to set it up, the unwanted referrals list for payment pages, how to test it and what to check when it does not work. Checked on 6 November 2026.
What cross-domain measurement fixes
Everything below comes from Google's own documentation, mainly the Google Analytics Help page Set up cross-domain measurement. If you have not set up GA4 yet, start with our Google Analytics 4 basics guide; this page covers only the case where one visit spans more than one domain.
GA4 uses first-party cookies, when there is consent, to give each user and each session an ID. Cookies belong to a domain, so without cross-domain measurement Google says a new cookie with a new ID is created on each domain a person visits. Someone who goes from www.example.com to www.anotherexample.com on the same device is counted as two users and two sessions instead of one. Joining the same signed-in person across different devices is a separate feature, covered in our GA4 User-ID guide.
With cross-domain measurement, the IDs travel with the visitor in a URL parameter called _gl when they move between your domains through a link or a form. Analytics then sees one user and one session. A side effect Google mentions: clicks to a domain you have listed no longer count as outbound clicks in enhanced measurement, because that domain is now treated as part of your own site.
When you need it, and when you do not
The typical case Google gives is a main website plus a separate shopping cart domain. Other common set-ups are a booking system, a member area or a landing page builder on its own domain. What they have in common: you can put your own Google tag on every domain involved.
You do not need it for pages on the same domain. For subdomains, Google says this set-up is recommended when visitors move to a subdomain that uses a different cookie domain, because self-referrals can appear and your traffic may then be attributed incorrectly. Its other advice for preventing self-referrals is to tag every page with the Analytics code, configure cross-domain measurement correctly on all pages, and check that all subdomains use the same cookie domain.
If the second domain belongs to someone else, such as a payment provider whose pages you cannot tag, cross-domain measurement is not the tool. That case is handled by the unwanted referrals list, covered below. For how hosted payment pages work, see our guide to accepting payments online.
Before you start: one tag ID
Google is specific here: the tag on each page must use the same tag ID (the same G- ID) from the same web data stream. If your shop platform asks for a measurement ID, give it the one from your main website's stream, not a new property. Google explains where to see it in Find your Google tag ID.
You also need the Editor role or above on the Google Analytics account to set up cross-domain measurement.
Setting it up in GA4 Admin
Google recommends doing this in the Analytics interface rather than in code. The steps, as Google lists them:
- In Admin, under Data collection and modification, click Data streams.
- Click Web, then click your web data stream.
- In the web stream details, click Configure tag settings at the bottom.
- In the Settings section, click Configure your domains.
- If the same Google tag already runs on several domains, they show up under Recommendations; click Add to accept one.
- To add a domain by hand, click Add condition, choose a match type and enter the domain, for example example.com. Add every domain that is part of the journey.
- Click Save.
You can create up to 100 conditions, and they are evaluated using OR logic. The Google tag settings page describes the same list as all of your domains that use this tag, which also defines which links do not trigger outbound click events.
Google Tag Manager and code-based setups
Google's developer page Measure activity across domains explains the mechanism under the Admin setting. The source domain decorates links that point to the destination domain with a linker parameter; on the destination domain, the tag looks for that parameter and, if it is valid, stores the cookie values from it. Linker parameters expire after two minutes, so the parameter is only added at the time of the click.
For GA4 itself, Google's recommended approach is the Admin setting above. If you use Google Tag Manager for Google Ads and Floodlight tags, Google says you can configure cross-domain linking in the container's settings when you connect to Google destinations with Destination tags, without a Conversion Linker tag; for other set-ups you create a Conversion Linker tag and set it to auto-link domains.
For sites that add the tag in code, the linker is set with gtag('set', 'linker', {'domains': ['example.com']});, and Google says Analytics honours it as long as it is set before the relevant config command. The options worth knowing:
- decorate_forms is false by default. Set it to true if visitors move between your domains by submitting a form rather than clicking a link.
- accept_incoming is true by default once domains has a value; it tells the destination page to read the parameter.
- url_position is query by default; it can be set to fragment.
Google also documents a fully manual route for custom cases: read the client ID and session ID with the gtag get command on the first domain, pass them in the link, and set them with the config command on the second domain. It is a developer job, and Google's advice is to use the Admin setting unless you have to.
Unwanted referrals and payment pages
Google's page Identify unwanted referrals covers traffic from domains you do not want shown as a traffic source. Its main example is a third-party payment processor that sends shoppers back to your site after checkout. Another is a password-reset email whose domain sends people back to your site. When a condition matches, Analytics adds ignore_referrer=true to the event, so that referrer is not shown as the source.
Some cases are handled already. Analytics does not count a referral when the referring site is the same domain as the current page or one of its subdomains, or when the visitor arrived through your cross-domain set-up with _gl in the URL.
To add a domain: Admin, Data streams, Web, your stream, Configure tag settings, then in Settings click Show all and choose List unwanted referrals. Add a condition per domain and click Save. You can configure a maximum of 50 unwanted referrals per data stream, and you need the Editor role or above at property level.
Two points from Google that save confusion later:
- The list does not rewrite history. A user who first came from a domain before you listed it, and later returns directly, can still be attributed to that domain because of last non-direct click attribution.
- Setting
ignore_referreron individual pages or events is possible, but Google says most site owners will not need it and warns against using it on all pages, because you may lose traffic source information. Any value, even false or 0, makes the referrer ignored.
Checking that it works
Google's test is simple and needs no tools:
- Open a page with a link or form that leads to one of your configured domains.
- Click the link or send the form.
- Check that the destination page loads correctly.
- Check that its URL contains the
_glparameter. - If your site offers downloads, start one from a page that has the parameter in its URL and confirm it works.
To watch the events themselves, use DebugView. Google suggests enabling debug mode for your own device through Tag Assistant or preview mode, which adds a parameter to your address so you can pick out your own visit. If you set debug_mode in code instead, note that setting it to false does not turn it off; you have to remove it. In Tag Manager, preview mode opens Tag Assistant: click Preview, then Connect, and your site opens in a connected window.
When it is not working
Google lists these causes when _gl does not appear on the destination page:
- The domain does not match. Check that the domain in your Admin list matches the domain your links actually point to.
- A redirect drops the parameter. If the destination redirects, or does not accept extra query parameters,
_glcan be removed even though it was added. Google notes this usually happens too fast to see, and suggests checking the network requests in Chrome Developer Tools. The fix is to keep_glthrough the redirect. - The navigation is triggered by JavaScript rather than directly by the user's click.
- Another script stops the click event from reaching the document, for example with
Event.stopPropagation().
The last two need a web developer, because the fix is in the site's own code. In rare cases, Google says, the added parameter can make a web server return an error, which is why the test above checks that pages and downloads still load.
A checklist
- Every domain in the journey carries the same G- ID from one web data stream.
- All those domains are listed under Configure your domains.
- Forms that cross domains are covered (decorate_forms in code-based set-ups).
- Redirects on the destination keep
_gl. - Payment providers and other domains you cannot tag are in the unwanted referrals list.
- A test click shows
_glin the URL and one session in DebugView.
Once the data is joined up, you can follow the whole path in GA4 Explorations, and tag your campaign links as shown in our UTM tracking links guide.
Frequently asked questions
What does the _gl parameter in my URL mean?
It is the linker parameter GA4 adds when a visitor clicks from one of your configured domains to another. It carries the user and session IDs so Analytics counts one user and one session instead of two.
Do I need cross-domain tracking for subdomains?
Not for pages on the same domain. Google recommends it for subdomains that use a different cookie domain, because self-referrals can appear otherwise.
Should I add my payment provider to cross-domain measurement?
Only domains that carry your own Google tag belong there. For a third-party payment page you cannot tag, Google's example is to add it to the unwanted referrals list so returning shoppers are not credited to it.
Why is GA4 cross-domain tracking not working?
Google lists four common causes: the domain in your Admin list does not match your links, a redirect on the destination drops the _gl parameter, navigation is triggered by JavaScript instead of a click, or another script stops the click event.
How many domains can I add?
Google allows up to 100 conditions in Configure your domains and up to 50 unwanted referrals per data stream.
Who can set it up?
You need the Editor role or above on the Google Analytics account.
Running your site, shop or booking system across several domains? See our website development service and all our services, or email [email protected].