
What Is Cross-Domain Tracking and When Do You Need It?
Cross-domain tracking is needed when your user journey spans two or more separate domains and you want GA4 to treat this as a single continuous session rather than separate, unrelated visits. Common scenarios include: an ecommerce site on yourstore.com that uses a third-party checkout hosted at checkout.paymentprovider.com; a main website at company.com with a separate blog at blog.company.com (if these are on different domains rather than subdomains of the same root); a marketing site at brand.com that links to a booking system at bookings.brand.net; or a multi-brand company with different domains for each product line that shares customer journeys.
Without cross-domain tracking, when a user navigates from yourstore.com to checkout.paymentprovider.com, GA4 sees two separate sessions with no connection. The checkout domain appears to receive traffic from a “referral” source of yourstore.com, and the conversion is not attributed to the original traffic source that brought the user to your store. Your revenue data becomes fragmented across two properties, and your conversion path analysis is broken at the domain boundary.
How GA4 Cross-Domain Tracking Works
GA4 cross-domain tracking works by appending a URL parameter (_gl) to links between your configured domains. This parameter carries an encrypted version of the user’s GA4 client ID. When the destination domain receives this parameter in the URL, the GA4 tag on that domain reads it and uses the incoming client ID rather than generating a new one. This means both domains recognize the user as the same person with the same session, preserving attribution data and session continuity across the domain boundary.
The _gl parameter is added automatically to links by the GA4 tag when both domains are configured in the same GA4 property’s cross-domain settings. No manual URL modification is required—GA4 handles the parameter injection via JavaScript on the outbound link click event.
Step 1: Configure Cross-Domain Domains in GA4
In GA4, navigate to Admin → Data Streams → select your web stream → Configure tag settings → Configure your domains. This section lists the domains that should be treated as part of the same measurement context. Click “Add condition” and enter each domain that is part of your user journey. For example, if your store is at yourstore.com and checkout is at secure.checkout-provider.com, add both domains here. GA4 accepts domain conditions as “contains” matches—so entering yourstore.com will match yourstore.com, www.yourstore.com, and any subdomain.
Save the configuration. GA4 will now automatically inject the _gl parameter on links between these configured domains. This configuration applies to the gtag.js implementation on your site. If you are implementing GA4 through GTM, the configuration in GA4’s Data Streams settings still applies because the GTM GA4 Configuration tag loads the same gtag.js library.
Step 2: Configure Cross-Domain in GTM (GA4 Configuration Tag)
If you manage GA4 through GTM, you should also configure cross-domain settings in the GA4 Configuration tag in GTM. Open your GA4 Configuration tag and scroll to “Configuration Settings.” Add a configuration parameter with the name linker and a value that references a GTM variable containing your cross-domain settings. Alternatively, use the “Cross Domain” section that appears in newer GA4 Configuration tag versions in GTM, where you can directly enter the domains to link.
For the most reliable setup, configure cross-domain in both GA4’s Data Streams settings and the GTM GA4 Configuration tag. The Data Streams configuration handles the gtag.js library-level settings. The GTM tag configuration ensures consistent behavior regardless of how the GA4 tag initializes. Duplicate configuration does not cause problems—GA4 simply uses both configurations and the more restrictive one wins if there is a conflict.
Step 3: Add the Destination Domain to the Referral Exclusion List
Even with cross-domain tracking configured, you must prevent the destination domain from appearing as a referral source in GA4. Without this exclusion, when the user returns from the checkout domain to your main domain (for example, after completing payment), GA4 may attribute that session to checkout-provider.com as a referral—overwriting the original traffic source attribution. In GA4, navigate to Admin → Data Streams → your stream → Configure tag settings → List unwanted referrals. Add your checkout domain (e.g., checkout-provider.com) to this list. GA4 will then ignore referrals from this domain and preserve the original session’s traffic source attribution through the entire cross-domain journey.
Step 4: Verify Cross-Domain Tracking Is Working
Use GTM Preview mode and GA4 DebugView to verify the implementation. Navigate from your main domain to the destination domain and check the URL in the destination domain’s browser address bar—you should see a _gl= parameter appended to the URL immediately after landing. If the _gl parameter is present, cross-domain linking is working at the tag level.
In GA4 DebugView, confirm that events on both domains appear under the same debug device (the same row in DebugView). If cross-domain tracking is working correctly, a page_view on your main domain and a page_view on your checkout domain will appear as consecutive events from the same user in DebugView without a session break between them. If they appear as separate debug devices, the client ID is not being successfully transferred between domains—revisit the domain configuration in GA4’s Data Streams settings.
Cross-Domain Tracking for Subdomains
Note that cross-domain tracking is not needed for subdomains of the same root domain. GA4 automatically maintains session continuity between www.yoursite.com and shop.yoursite.com because they share the same root domain (yoursite.com) and GA4’s cookies are set at the root domain level by default. Cross-domain tracking configuration is only required when crossing to an entirely different domain (different TLD, different root domain, or different ccTLD). If you have incorrectly configured cross-domain tracking for subdomains of the same root, it will still work but adds unnecessary URL parameters—clean up the configuration to keep your URLs tidy.
Troubleshooting: The _gl Parameter Is Not Appearing
If the _gl parameter does not appear when clicking links to the destination domain, check three things. First, confirm both domains are listed in GA4’s Configure your domains settings and that the domain matching is correct—a typo in the domain name will prevent parameter injection. Second, check that the GA4 tag is loading before the user clicks the link—if the tag loads asynchronously and the user clicks very quickly, the linker may not have initialized yet. Third, check whether any link-click handlers on your site are preventing the default link behavior or modifying the href attribute in a way that strips the _gl parameter before the browser navigates.
Conclusion
GA4 cross-domain tracking via GTM is essential for any business where the customer journey crosses domain boundaries—checkout platforms, booking systems, partner portals, or multi-brand sites. The three-part setup—configuring domains in GA4 Data Streams, adding the destination domain to the referral exclusion list, and verifying with DebugView—takes under an hour and immediately restores accurate attribution and session continuity across your entire conversion path. Without it, your acquisition reports undercount conversions and your channel attribution data tells a fundamentally incomplete story.