TapCub is live — analytics, insights and live chat, free on one platform
Analytics

Cross-Domain Tracking: Setup and a Before and After Check

How cross-domain tracking keeps one visit as one visit across two domains: a worked before and after month, the setup steps, a failure table by symptom and a verification checklist.

Lin Zhou Published Nov 20, 2026 11 min read Analytics
Sample data: without the handoff the checkout domain counts 300 extra users (1,300 vs 1,000) and paid social shows 0 of its 60 orders; with it the cost per order is $1,800 ÷ 60 = $30.00.Sample data

Cross-domain tracking passes a visitor's identity from one domain to another so that one visit stays one visit. Without it, each domain starts fresh: in the sample below users are counted 30% too high, your own site becomes the source of every checkout session, and a campaign that returns $30 per order shows no conversions.

What you will learn

  • Needed when a journey crosses different root domains; subdomains of one root usually share a cookie
  • In the sample, skipping it inflates users from 1,000 to 1,300 and hides 60 paid social orders
  • Verify by clicking through, checking for the _gl parameter, then comparing sources and users after a day and a week

What cross-domain tracking is, and when you need it

Cross-domain tracking passes a visitor's identity from one domain to another, so the visit stays one visit. Without it, each domain starts from scratch. Google's documentation says it plainly: when cross-domain measurement is off, each domain gets new cookies, so one person visiting two root domains is counted as two users and two sessions.

You need it when one journey crosses different root domains, for example:

  • a marketing site on example.com and a checkout or booking engine on pay-example.net;
  • a store and a separate help or account portal;
  • a brand with several country domains where people move between them.

You mostly do not need it for subdomains of one root domain (www.example.com and shop.example.com), because a cookie set for the root domain can usually be read by both. Google still recommends the setup for subdomains in some configurations, because navigation between them can create self-referrals when cookie domains differ. The checklist later in this article covers that case.

What breaks without it: a before and after split

Take a sample month (sample data). The marketing site gets 1,000 visitors: 600 from paid social, which cost $1,800, and 400 from organic search. Of them, 300 follow the "Buy" button to the checkout domain (200 paid, 100 organic), and 30% of those buy: 60 paid orders and 30 organic orders, 90 in all.

What you readWithout cross-domainWith cross-domain
Users across both domains1,000 + 300 = 1,3001,000
Checkout domain sessions by source300 from "marketing site / referral"200 paid social, 100 organic
Paid social conversions060
Paid social conversion rate0.0%60 ÷ 600 = 10.0%
Paid social cost per ordernot defined ($1,800 ÷ 0)$1,800 ÷ 60 = $30.00
Organic conversion rate0.0%30 ÷ 400 = 7.5%
Checkout conversion rate90 ÷ 300 = 30.0%90 ÷ 300 = 30.0%

Three things go wrong at once. The user count is inflated by 300, which is 30% above the true 1,000. Your own marketing site becomes the "source" of every checkout session, a self-referral. And the campaign that produced the orders gets none of the credit, so a channel that returns $30 per order looks like pure waste. The checkout conversion rate is the same in both columns, which is why the problem hides: nothing on the checkout dashboard looks broken. This is one of the usual reasons unique visitors never match between two tools.

app.tapcub.com

One month, with and without cross-domain tracking

1,000 visitors
Paid social conversions: without0
Paid social conversions: with60
Users counted: without1,300
Users counted: with1,000
Sample data
Sample data: without the handoff the checkout domain counts 300 extra users (1,300 vs 1,000) and paid social shows 0 of its 60 orders; with it the cost per order is $1,800 ÷ 60 = $30.00.

How the handoff works

In Google Analytics 4, the source domain adds a _gl parameter to links and forms that point to another configured domain. It carries the client and session identifiers. Google's example URL looks like https://www.example.com/?_gl=1*abcde5***. The destination page reads the parameter, rebuilds the same identifiers in its own first-party cookie, and the two halves join.

Two details matter in practice:

  1. It happens on click or submit. The linker relies on a click listener on the document and on form submits. If the navigation is triggered by JavaScript (window.location = ...) or a script stops the click event before it reaches the document, nothing is added to the link.
  2. The parameter must survive. If the destination redirects (for example from /pay to /pay/ or to a language path) and drops the query string, _gl is lost and a new ID is created.

Browser rules add a second limit. WebKit's published Intelligent Tracking Prevention notes cap client-side cookies at seven days, and later extended that cap to LocalStorage and IndexedDB for sites without user interaction. A visitor who clicks over to a second domain a week later on Safari may therefore look new even when the linker works.

How to set it up, step by step

These steps follow Google's help page for GA4 and are the common pattern for other tools; check your tool's own page for its names.

  1. Use one tag ID everywhere. Every domain must send data with the same measurement ID from the same web data stream. Different IDs cannot be joined.
  2. Open the domain list. In GA4, go to Admin, then Data streams, choose the web stream, then Configure tag settings and Configure your domains.
  3. Add each domain as a condition. Accept the domains offered under Recommendations, or add a condition with a match type and the domain. Conditions use OR logic, and the limit is 100 conditions. You need the Editor role or above.
  4. Match the domain you link to. If your links point to pay.example.net, a condition for example.net has to match it. A mismatch is the most common reason _gl is missing.
  5. Keep cookie domains consistent across subdomains and add them to the referral exclusion (unwanted referrals) list so internal hops do not become sources.
  6. For custom builds, read the client and session IDs on the source domain and add them to destination links as parameters, then read them from the URL and pass them to the tag on the destination.

If you manage the tag through a tag manager, set the same domain list in the tag's configuration, not in two places.

What breaks it: redirects, forms, iframes and payment pages

Most failures are one of these:

SymptomLikely causeFix
_gl missing on the destination URLLink domain does not match a configured conditionAdd or correct the domain condition
_gl present, but a new user appearsA redirect dropped the query stringPreserve the parameter in redirects
Works on links, not on one buttonNavigation done in JavaScript, or a script stops the click eventUse a real link, or decorate the URL in code
Works for the buy button, not for the return from the payment providerThe provider sends the person back without the parameterPass the identifiers to the provider as metadata, or accept a session break there
All checkout sessions say "referral"Self-referral from the missing handoffFix the handoff first, then exclude the domain
Works in Chrome, breaks on iPhonesBrowser storage limitsTest Safari separately; expect some loss

The payment-provider return is the hardest one. If the provider hosts the payment page on its own domain, you cannot add your tag there. The two stable options are to let the provider send the person back to a page on your own domain that carries the order number, or to join orders to sessions on the server using that order number.

SymptomLikely causeFix
_gl missing on the destination URLLink domain does not match a configured conditionAdd or correct the domain condition
_gl present but a new user appearsA redirect dropped the query stringPreserve the parameter in redirects
Works on links but not one buttonNavigation in JavaScript, or a script stops the click eventUse a real link or decorate the URL in code
Fails when returning from the payment providerProvider returns without the parameterReturn to your own domain with the order number and join on the server
Every checkout session says referralSelf-referral from the missing handoffFix the handoff, then exclude the domain
Works in Chrome but not on iPhonesBrowser storage limitsTest Safari separately

Causes for _gl failures come from Google Analytics Help (redirects, click listener, domain match); the rest are common patterns to test.

The verification checklist

Google's help page gives five steps; the extra rows are what separates "set up" from "working".

  • [ ] Open a page that links to the other domain, click the link, and confirm the destination page loads.
  • [ ] Confirm the destination URL contains _gl.
  • [ ] Start a file download from a page with the linker, if you offer downloads, and confirm it succeeds.
  • [ ] Submit any form that points to the other domain and confirm _gl is on the form's target URL.
  • [ ] In real-time reports, follow your own test visit across the two domains and confirm it appears as one user.
  • [ ] After a day, compare sources on the destination domain: your own domain should not be the top referrer.
  • [ ] After a week, compare users across domains with the before and after table above: the 30% inflation should disappear.
  • [ ] If sources show as "(not set)" after the change, see what "(not set)" means in Google Analytics.
  • [ ] Repeat the first three on iPhone and Android, not just a desktop browser.

When a single domain is simpler

Cross-domain tracking is maintenance: a domain list, a redirect rule, and a test after every checkout change. Ask whether the second domain is necessary. A checkout moved to a subdomain of your main domain (pay.example.com) removes the handoff problem completely, because the cookie can be shared. If a provider forces its own domain, use the server-side order-number join described above rather than relying on the linker alone.

Cross-domain tracking in TapCub

Return to the sample: the marketing site and the checkout live on different domains, and you want the $1,800 paid social spend matched to the 60 orders.

  1. Register both hostnames as data sources of one project. Open Web analytics › Configuration › SDK code and add each hostname without a scheme or path. Subdomains of a registered hostname are allowed. If a hostname is not registered, the collector drops its events silently and still returns a success code, so a checkout domain with no data usually means it was never added.
  2. Install the same script on both sites.
  3. Understand what is different. TapCub's website script does not write a cookie by default. The collector builds the visitor ID from a site salt plus the address and browser data. There is no per-domain cookie to hand across, and TapCub's docs describe no link-decoration step.
  4. Test it. Click from the marketing site to checkout and watch Web analytics › Realtime and Web analytics › Sessions. If the two pageviews appear as one visitor, the journey is joined. Switching network between the pages (mobile data to Wi-Fi) changes the address and can produce a new visitor, and the strict privacy preset rotates the salt each project day.
  5. For logged-in users, call tapcub.login on both domains with the same login ID. This is available in identified mode on plans that include it. The person then appears once in All-platform analytics › Users › People, regardless of device or domain.
  6. Check the result in Web analytics › Goals: select the "order confirmed" goal and read its source breakdown. It should show your paid social source, not your own marketing domain.

TapCub does not rewrite links with a _gl-style parameter, and a payment page hosted by a provider on its own domain cannot carry your script. For that last hop, join on the order number.

FAQ

What is cross-domain tracking?

It is the practice of keeping one visitor's identity when they move between separate root domains, so sessions are not split and the original source is not replaced by your own domain. In GA4 it works by adding a _gl parameter to links and forms.

Do subdomains need cross-domain tracking?

Usually not, because a cookie set for the root domain can be read by every subdomain. Google still lists subdomains as a case where the setup prevents self-referrals if cookie domains differ. Check that all subdomains use the same cookie domain.

How many domains can I configure in GA4?

Google's help page states a limit of 100 conditions. Conditions use OR logic, and you need the Editor role or above on the account to set them.

Why do I see my own domain as a referral?

Because a visitor arrived through a link that did not carry the identifiers, so the destination started a new session with your first domain as the referrer. Fix the handoff first, and use the referral exclusion list only as a second layer.

Does cross-domain tracking work on Safari?

Partly. WebKit caps client-side cookies at seven days, and the same limit applies to LocalStorage and IndexedDB, so long gaps between domain visits can still show as new visitors. Test on iPhone separately.

Sources

Filed underAnalytics

Was this article helpful?

We use your answers to fix and expand this page.

Lin Zhou

Product Experience Specialist

Writes about product experience, practical workflows, and growth, turning complex processes into clear steps for everyday decisions.

See which campaign brought the order

Sources, UTM campaigns and goal conversions in one project, with bots counted separately.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics