Full Guide to Cross-Domain Tracking in Google Analytics 4

 

The Ultimate Guide to Cross-Domain Tracking in Google Analytics 4

 

If you’ve worked with cross-domain tracking in Universal Analytics, you’re likely familiar with the complex configuration—often done either in the code (like in gtag.js) or through Google Tag Manager (using Google Analytics tags). This left many marketers and web analysts confused about where to start.
Thankfully, in Google Analytics 4, the process is much simpler.
In this guide, I’ll walk you through how to configure cross-domain tracking in Google Analytics 4. We’ll begin by discussing the challenges it addresses, followed by a step-by-step guide to the setup.

Video Tutorial:⤵️

 


The Problem of Cross-Domain Tracking in Google Analytics

By default, Google Analytics uses first-party cookies to track users. When someone visits your site, Google Analytics places a _ga cookie in their browser, which includes a unique identifier. As the user navigates from one page (let’s call it page X) to another (page Y) on the same domain, Google Analytics recognizes this movement and groups both page views under the same session and user.
This setup works well on a single domain. However, issues arise when visitors move between different domains.
First-party cookies like those used by Google Analytics cannot be shared across multiple domains due to cross-domain policies. So, if a user starts on domainX.com and continues to domainY.com, Google Analytics on domainY.com won’t know it’s the same user who was on domainX.com, even if both sites share the same Google Analytics property.
When a user moves from domain X to domain Y, Google Analytics on domain Y cannot access the cookies set by domain X, so it creates new ones.
The result? Google Analytics will view this as two different users, one for domain X and one for domain Y.
This leads to inflated user counts in your reports. Every visitor who moves between domainX.com and domainY.com will be counted twice. Additionally, a new session will start each time, and domainX.com will appear as a referral source for domainY.com, causing “self-referrals” that distort your data.

The Ultimate Guide to Cross-Domain Tracking in Google Analytics 4
What should you do? Implement cross-domain tracking.

 


What is Cross-Domain Tracking in Google Analytics 4?

 

Cross-domain tracking is a method that allows webmasters, marketers, and analysts to carry a visitor’s identifiers from one domain to another, preserving session information. This ensures that the visitor is tracked as the same user across multiple websites or domains.
For cross-domain tracking to work, both websites must be connected to the same Google Analytics 4 data stream (using the same measurement ID).


How Does Cross-Domain Tracking Work in Google Analytics 4?

 

When a user navigates from domainX.com to domainY.com, Google Analytics 4 adds a special parameter to the URL on domainY.com. This parameter helps Google Analytics on domainY.com recognize that the user came from domainX.com, ensuring their activity is tracked as a single session across both domains.


Will Google Analytics Track Subdomains?

 

Yes, and you do not need cross-domain tracking for subdomains.
If you’re tracking different sections of the same domain, such as blog.yourwebsite.com and www.yourwebsite.com, Google Analytics 4 will handle it automatically.
So, if you’re wondering, “Is a subdomain considered cross-domain?” the answer is no in this case.

How to Set Up Cross-Domain Tracking in Google Analytics 4

Now that you know the issue and solution, let’s move on to the setup.
Before starting, ensure both websites you want to include in cross-domain tracking use the same GA4 property. Whether the code is installed directly via gtag.js or through Google Tag Manager, both must be linked to the same GA4 property.

Step 1: In Google Analytics, go to the Admin panel, navigate to Data Streams, and select your web data stream.

Step 2: Go to Configure Tag Settings.

Step 3: Go to Configure Tag Settings.

 

Step 4: Click Configure your domains.

Step 5: Enter all the domains that need to be included in cross-domain tracking, and then click Save.

That’s it! There’s no need to configure the referral exclusion list, as Google Analytics automatically manages it. However, if you still see your own domains appearing as traffic sources, adjust your settings to exclude unwanted referrals.
Note: This will also affect automatic outbound click tracking in Enhanced Measurement. Any domains entered here will no longer be considered outbound clicks.

Test the Setup

After saving your changes, wait a minute and visit your first website (let’s assume it’s domainX.com). Find a link that directs you to domainY.com and click it.
Once you’re redirected to domainY.com, check the URL—it should contain the _gl= parameter with additional data.

You can also use the GA Debugger extension and open the DebugView in Google Analytics 4. Look for your device and check for multiple page_view events. Some of the events should show page_location as domainX.com, while others will show domainY.com, confirming that cross-domain tracking is working properly.


Watch Out for Redirects

If the URL on domainY.com doesn’t contain the _gl parameter, a JavaScript redirect could be causing an issue. To troubleshoot, use the Redirect Path extension.
Install the extension, visit domainX.com, and click the link to domainY.com. Then, check the Redirect Path extension to see if the _gl parameter was there initially but disappeared later. If this is the case, consult your developers to debug the issue further. The goal is to ensure the _gl parameter persists.


Frequently Asked Questions About Cross-Domain Tracking

 

  1. What is cross-domain tracking in Google Analytics 4?
    Cross-domain tracking enables you to follow a user’s journey across multiple domains as a single session, ensuring consistent tracking of their activity.
  2. Do I need cross-domain tracking for subdomains?
    No, subdomains are handled automatically by Google Analytics 4, so there’s no need to configure cross-domain tracking.
  3. What’s required for cross-domain tracking to work?
    Both domains must use the same GA4 property (with the same measurement ID). The tracking code can be implemented either directly or via Google Tag Manager, but both must be linked to the same property.
  4. What happens if I don’t set up cross-domain tracking?
    Without it, Google Analytics will count users moving between domains as separate users, leading to inaccurate user counts and the potential for “self-referral” issues in your reports.
  5. How does cross-domain tracking work?
    When a user navigates between domains, Google Analytics adds a special _gl parameter to the URL, allowing it to recognize the user and track them as the same individual across both domains.
  6. How can I test if cross-domain tracking is working?
    After setting it up, visit your first domain and follow a link to the second. Check the URL on the second domain for the _gl parameter, and use the GA Debugger extension to confirm tracking across both domains.
  7. What if the _gl parameter is missing after a redirect?
    If the parameter disappears, it could be due to a JavaScript redirect. Use the Redirect Path extension to troubleshoot the issue.
  8. Will cross-domain tracking affect outbound click tracking?
    Yes, any domains included in cross-domain tracking will no longer be considered outbound clicks in Enhanced Measurement.
  9. Do I need to adjust the referral exclusion list?
    No, GA4 handles this automatically, but you can manually adjust it if you see unwanted self-referrals.

Google Analytics 4 Cross-Domain Tracking: Final Thoughts

Cross-domain tracking in GA4 is fairly simple to implement, but it does have limitations.
It works smoothly when a visitor moves between domains via a link click. However, it doesn’t support tracking for button clicks coded with <button> HTML elements or for form submissions. While there are workarounds, they rely on reverse-engineering and may break if Google changes how it handles cross-domain tracking in the future.

Ready to Optimize Your Analytics Setup?

Now that you’ve learned how to configure cross-domain tracking in Google Analytics 4, take the next step and ensure your website data is accurate and actionable. If you need expert help with advanced tracking setups or want to ensure everything is working perfectly, feel free to reach out!
Book A Schedule  today to get personalized guidance or explore how I can assist with all your web analytics needs. Let’s elevate your data insights together!

Subscribe to Our Newsletter

Get the Latest Updates

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top