Setting Up Cross-Domain Tracking in Google Analytics
A business running its marketing site on one domain and its checkout or app on another — a common pattern for companies using a separate e-commerce platform or a dedicated app subdomain — has a specific tracking problem: without configuration, GA4 treats a visitor moving between the two domains as if they left and arrived from a completely new source, splitting one continuous visit into two disconnected sessions with incorrect referral attribution. Cross-domain tracking fixes this.
What Happens Without Cross-Domain Configuration
By default, when a user navigates from www.example.com to checkout.example-payments.com, GA4 sees the second domain as a brand-new destination, with the first domain showing up as a referral source. This creates two visible problems:
- Session splitting — what was actually one continuous visit gets recorded as two separate sessions, inflating your total session count and understating true engagement duration.
- Attribution corruption — the second domain's activity gets incorrectly attributed to "Referral: example.com" rather than being recognized as a continuation of whatever original channel (organic search, paid ad, email) brought the user to your first domain.
Enabling Cross-Domain Measurement
- In GA4, go to Admin → Data Streams → [your web stream].
- Click Configure tag settings.
- Click Configure your domains.
- Add each domain that should be treated as part of one continuous user journey (e.g.,
example.comandcheckout-provider.com). - Save.
Once configured, GA4 automatically appends a special linking parameter (_gl) to outbound links between the listed domains, which carries the necessary client ID information across the domain boundary so the destination page can recognize it as the same ongoing session.
Verifying Cross-Domain Tracking Is Working
- Open your site in an incognito window.
- Navigate from your primary domain to the linked secondary domain, using an actual link on the page (not by manually typing the second domain's URL).
- Check the resulting URL on the destination domain — it should include a
_glquery parameter if cross-domain linking fired correctly. - In Admin → DebugView, confirm the session continues under the same client ID across both domains, rather than starting a fresh session on the second domain.
Common Cross-Domain Tracking Issues
- Links opened via JavaScript redirects or non-standard navigation — GA4's automatic link decoration primarily targets standard
<a>tag clicks; a redirect performed viawindow.location.hrefin custom JavaScript may not automatically receive the_glparameter unless handled explicitly. - Server-side redirects stripping the parameter — if your infrastructure performs a server-side redirect between domains, confirm the redirect logic preserves the
_glquery parameter rather than dropping it during the redirect. - Missing a domain from the configured list — if your checkout flow spans three domains and only two are configured, the third will still show session splitting even though the other two work correctly.
- Subdomains vs. separate domains confusion — subdomains of the same root domain (like
shop.example.comandwww.example.com) generally share cookies and don't require cross-domain configuration the way two entirely separate domains do; check whether your specific situation is genuinely cross-domain or just cross-subdomain before assuming this setup is needed.
Cross-Domain Tracking with Google Tag Manager
If you manage tags through GTM rather than a direct gtag.js snippet, cross-domain configuration lives in the same place — under your GA4 Configuration tag's settings:
- Open your GA4 Configuration tag in GTM.
- Under Fields to Set (or the dedicated cross-domain configuration section, depending on GTM's current interface), add your list of linked domains.
- Test in Preview mode by navigating between domains and confirming the
_glparameter appears and the session continues correctly.
Handling Cross-Domain Tracking for Third-Party Checkout Providers
If your checkout is hosted entirely by a third-party provider (Shopify, a payment processor's hosted checkout page) rather than your own second domain, cross-domain configuration works differently — you typically can't add tracking configuration to a domain you don't control. In this case:
- Check whether the provider offers a native GA4 or Google Ads integration that handles attribution continuity on their end.
- Some providers support passing a client ID or campaign parameters through to their hosted checkout via a supported query parameter, preserving at least some attribution continuity even without full cross-domain linking.
- Accept that some attribution gap may be unavoidable with certain third-party hosted checkout providers, and treat drop-off analysis between your site and the checkout provider's own reporting as a manual cross-reference rather than a unified GA4 view.
FAQ about Setting Up Cross-Domain Tracking in Google Analytics

Do subdomains need cross-domain tracking configured?
Generally no — subdomains of the same root domain typically share cookies natively and don't split sessions the way genuinely separate domains do, though it's worth verifying this for your specific cookie configuration.
What does the _gl parameter in my URLs actually do?
It carries client ID and other linking information across a domain boundary, letting the destination domain recognize the visit as a continuation of the same session rather than a new one.
Does cross-domain tracking work automatically once I add domains to the list?
For standard link clicks, yes — GA4 automatically decorates outbound links to configured domains. Custom JavaScript-driven navigation or server-side redirects may need additional handling to preserve the linking parameter.
Can I set up cross-domain tracking for a third-party hosted checkout I don't control?
Not fully in most cases, since you can't add tracking configuration to a domain you don't own — check whether the provider offers its own native GA4 or attribution integration instead.
How do I know if cross-domain tracking is actually working correctly?
Check DebugView to confirm the same client ID persists across both domains during a single test journey, and check that outbound links to the configured domain carry the _gl parameter.
Does cross-domain tracking affect conversion counting?
Yes, correctly configured cross-domain tracking ensures a conversion completed on a second domain is properly attributed to the original session and its original acquisition channel, rather than being misattributed as a new, unrelated referral-driven session.
Conclusion
Cross-domain tracking is a quiet but critical fix for any business spanning more than one domain, preventing Google Analytics from silently fragmenting one continuous visit into disconnected sessions with broken attribution. Configure every relevant domain, verify with a real cross-domain test in DebugView, and your website's multi-domain journeys will finally be measured as the single continuous visits they actually are.


