Search the site:

Copyright 2010 - 2025 @ DevriX - All rights reserved.

How to Set Up Cross-Domain Tracking in GA4 (Step-by-Step Guide)

How to Set Up Cross-Domain Tracking in GA4

Cross-domain tracking in GA4 solves a critical analytics challenge: maintaining user identity as visitors navigate between your related websites.

Without the setup, you’d see fragmented user journeys whenever someone moves from one of your domains to another.

When properly configured, cross-domain measurement creates a continuous data stream that preserves user attribution across domain boundaries.

This means you can accurately track user paths and conversions even when they span multiple websites under your control.

As an added benefit, GA4’s cross-domain implementation intelligently suppresses redundant outbound click events when users navigate to domains you’ve designated as part of your measurement configuration.

What Is Cross-Domain Tracking in GA4?

Cross-domain tracking in GA4 is a configuration that allows you to maintain user identity as visitors move between different domains you own or manage. It works by passing user identifiers from one domain to another, preserving session information and ensuring the visitor is tracked as the same person throughout their journey across your websites.

For this functionality to work properly, all domains must share the same GA4 data stream (using the same measurement ID). When implemented correctly, cross-domain tracking passes a special parameter in the URL when a visitor navigates from one domain to another. This parameter enables GA4 on the destination domain to recognize the visitor as the same user, maintaining continuity in analytics data.

Common Use Cases for Cross-Domain Tracking

  • E-commerce with Third-Party Payment Providers

If your checkout process redirects to an entirely different domain (e.g., shop.com → securepayment.com), GA4 won’t track the user by default. Cross-domain tracking ensures ecommerce businesses don’t lose conversion data.

  • B2B Lead Generation Across Multiple Domains

Some companies use different domains for marketing and lead collection (e.g., company.com → leadform.net). Without cross-domain tracking, GA4 might treat them as separate users, making it harder to measure conversions.

  • SaaS Companies with a Marketing Site and Product Platform

If your SaaS marketing site (saascompany.com) directs users to a separate domain for login (app.saasproduct.io), you need cross-domain tracking to analyze the full user journey from website visitor to active customer.

  • Media Networks and Affiliate Marketing

Publishers and media networks often drive traffic between partner sites (newsnetwork.com → partnerblog.com). Cross-domain tracking helps measure user engagement across these properties.

  • Franchise or Dealer Networks

A car manufacturer (brandcars.com) might have independent dealer websites (dealer123.com). Cross-domain tracking ensures marketing efforts on the brand’s main site are properly credited for leads captured on dealer sites.

  • Government or Nonprofit Organizations with Multiple Services

A government agency (govagency.gov) might direct users to a separate site for applications (applyhere.org). Cross-domain tracking provides insights into the full user experience.

Is GA4 tracking subdomains?

Yes, and you don’t need cross-domain tracking for that. GA4 can track all traffic coming to your subdomains.

What You Need Before You Get Started

Before implementing cross-domain tracking in GA4, you’ll need to have several prerequisites in place:

1. GA4 Property Set Up – Ensure you have a GA4 property created in your Google Analytics account. You’ll need admin access to this property to configure cross-domain settings.

2. Google Tag Manager Account – While GTM isn’t strictly required (you can implement GA4 directly), using Google Tag Manager significantly simplifies the process. Make sure you have:

  • A GTM container created for each domain
  • Admin access to these containers
  • GTM properly installed on all websites involved

3. List of All Domains to Track – including:

  • Your primary domain
  • Secondary domains
  • Any checkout or application domains
  • Partner domains you control and want to include

4. Same GA4 Measurement ID Across Domains – Verify that all domains use the same GA4 property. This is crucial for cross-domain functionality.

5. Website Access – Ensure you have the ability to modify the website code or GTM configuration on all domains involved.

6. URL Structure Understanding – Familiarize yourself with how links between your domains are structured, especially if there are query parameters already in use.

7. User Permissions – Confirm you have the necessary permissions to make changes to both your GA4 property and all websites involved.

Having these elements prepared before beginning will streamline your implementation process and help avoid complications during setup.

Setting up cross-domain tracking for GA4

Here’s what you need to do:

1. Open Google Analytics -> Admin -> Data Streams and select your data stream

2. Go to Configure tag settings -> Configure Your Domains

3. If you use the same Google tag across all domains, they will be automatically shown as recommendations. To accept a recommendation, click Add.

Or you can manually add a domain under “include domains that match the following conditions”

  • Choose a match type (we recommend contains)
  • Under domain enter the domain you want to match
  • Add each domain you want to include in your cross-domain measurement

NOTE: All new domains are evaluated using OR logic.

Time for a test

Once you did all the configuration, it’s time for a test!

Cross-Domain Tracking Testing

Troubleshooting Cross-Domain Tracking Issues in GA4

Despite following setup instructions, cross-domain tracking in GA4 sometimes doesn’t work as expected. Here’s a comprehensive guide to diagnosing and fixing the most common issues:

Issue: Incorrectly configured domains in GA4 settings.

Solution: Navigate to Admin > Data streams > [your stream] > Configure tag settings > Configure your domains. Verify all domains are correctly listed without typos.

Issue: Server redirects strip the _gl parameter from URLs, breaking the tracking chain.
Diagnosis: Use the Chrome extension “Redirect Path” to check if the _gl parameter disappears after clicking a cross-domain link.
Solution: Work with your development team to preserve URL parameters during redirects.

Issue: JavaScript code may redirect users and remove tracking parameters.
Diagnosis: Check the Redirect Path extension for “JAVASCRIPT” redirects.
Solution: Modify the JavaScript to preserve the _gl parameter or check if the redirect code is within GTM itself.

Issue: The .stopPropagation() JavaScript method prevents GA4 from detecting click events.
Impact: GA4 can’t add the _gl parameter to the URL when clicks don’t “bubble up” to the document level.
Solution: Ask developers to identify and modify code that stops event propagation.

Issue: Cross-domain tracking works with <a> link tags but fails with <button> or <div> elements.
Solution: Implement a custom tracking setup for non-link elements or convert interface elements to hyperlinks where possible.
Issue: Form submissions that redirect to another domain don’t pass tracking parameters. Solution for native gtag.js: Modify your code to include:

gtag('set', 'linker', {
'domains': ['domainA.com', 'domainB.com'],
'decorate_forms': true
});

Solution for GTM: Create a custom implementation that captures and passes client_id and session_id parameters.

Issue: Links within iFrames break cross-domain tracking when GA4 is installed on the parent page.
Solution: Implement communication between the parent page and iFrame to pass tracking parameters.

Issue: Different GA4 measurement IDs between domains.
Verification: Check the measurement ID (starting with “G-“) in your page source code.
Solution: Ensure all domains use the same measurement ID for proper cross-domain functionality.

Issue: GA4 tracking code absent from one of your domains.
Solution: Install the same GA4 tracking configuration on all domains involved in cross-domain tracking.

Issue: CSP blocks Google Analytics or GTM scripts on your secondary domain.
Diagnosis: Check browser console for CSP-related errors.
Solution: Update your CSP to include:

  • *.google-analytics.com
  • *.analytics.google.com in both “connect-src” and “img-src” directives.

Issue: Users grant consent on one domain but deny it on another.
Solution: Implement a consent management solution that shares permissions across domains (if your CMP supports this feature).

Issue: Other scripts interfere with GA4’s linker functionality.
Troubleshooting: Use browser developer tools to selectively block scripts and identify the culprit.
Solution: Work with developers to modify problematic scripts

Issue: The accept_incoming parameter in gtag.js is set to false on the destination domain.
Solution: Ensure the linker parameter is either not specified (defaults to true) or explicitly set:


gtag('set','linker', {
'accept_incoming': true
});

Issue: User-side privacy tools strip tracking parameters from URLs.
Limitation: This affects a subset of users and cannot be fully circumvented.
Consideration: Account for this data loss in your analytics assessments.

Best Practices for Troubleshooting

  • Start with the simplest explanations (domain configuration, measurement ID)
  • Use browser extensions like Redirect Path to visualize what happens to parameters
  • Collaborate closely with developers for technical solutions
  • Test in multiple browsers and privacy settings
  • Implement changes one at a time to isolate effective solutions

Remember that cross-domain tracking involves multiple technical components working together, so thorough testing after any changes is essential.

Browse more at:MarketingTutorials