Understanding Your Visitors: Easy Cross-Domain Tracking in Google Analytics 4

google analytics

Cross-domain tracking comes into play when you want to check whether a visitor is visiting more than one website if your company owns multiple websites, such as a main site and a shop site, e.g., websiteA.com and websiteB.com.
If you had an experience with an older version of Google Analytics (Universal Analytics), you might remember that it would not just require code tweaks to set up CDT but would be confusing at times, especially when changes needed to be configured within GTM. Unfortunately, for GA4, the opposite holds true: it’s simpler, with a handful of clicks from within the GA4 interface managing the entire thing.

The Problem: Why GA Gets Confused

Google Analytics, the tool built to provide business insights, uses first-party cookies, like the _ga cookie, set on the visitor’s browser.

  • If a person stays on the website (moving from page A to page B), GA reads the cookie, identifies the person, and aggregates the actions in one session.
  • The problem is this: A browser would not allow a cookie created by one site (domainA.com) to be read by a completely different site (domainB.com).

When a person on Domain A goes over to Domain B, GA at the Domain B site cannot read the IDs generated at the former site and hence has to generate a new ID from scratch.
This brings about two main reporting challenges:
Too Many Users: GA counts the one person as two separate visitors, one on each domain. This makes your user counts inflated and less accurate.
Self-Referrals: Since a new session starts on the second domain, GA registers the first domain (domainA.com) as the source of traffic. This “self-referral” problem distorts your marketing data, as it hides the true source (like a paid ad) that initially brought the visitor to your site.
Cross-domain tracking is simply a workaround to solve this confusion and track the visitor as the same person across all your websites.

How Cross-Domain Tracking Works in GA4

CDT in GA4 allows the information identifying the user to pass seamlessly between domains.

  • Requirement: If you want both websites to be tracked, then both websites must have the same Google Analytics 4 property (Measurement ID). The latest recommendation from Google is that within that property, the same data stream should be used.
  • Working: As soon as any visitor clicks on any link on the first domain (domainA.com) which takes him/her to the second domain (domainB.com), GA4 automatically appends a special code (called a parameter) to the destination URL.
  • Now, the GA code on the second domain reads this special code from the URL and uses it to update its local cookie. Thus, the visitor will carry the same identifying cookie value on both sites.

Easy Steps to Configure CDT in GA4

You can set up cross-domain tracking directly in the GA4 interface.
Prerequisite: Ensure the same GA4 property is installed on all domains.

  1. Go to the Admin section of Google Analytics.
  2. In the Property column, select Data Streams and choose your web data stream.
  3. Click Configure Tag Settings.
  4. Click Configure your domains.
  5. Use the pencil icon to enter all domains that are part of the user journey (e.g., domainA.com and domainB.com).
  6. Click Save.

Once these domains are configured, GA4 automatically recognizes them and handles the self-referral issue, so you do not need to set up a separate referral exclusion list. Note that domains listed here will also not be tracked as outbound clicks.

How to Check Your Setup

Now, after editing and saving the configuration, testing it for working must be done.

  • Check URL: Go to your first website, click on the link that redirects to the second domain, and look at the URL on the second domain. It should contain the _gl= parameter.
  • Check Cookie: Use your browser’s developer tools to check the _ga cookie values on both domains. The value of the _ga cookie should be exactly the same.
  • Check DebugView: Activate the GA Debugger extension, open the DebugView in GA4, navigate between two domains, and the device count should stay at one, and you should see events for both domains in turn.

If the _gl parameter is lost during the redirection, it often means there is a problem with a JavaScript redirect, and the persistence of this parameter should be debugged.

Conclusion: Simplified and Accurate Tracking

Cross-domain tracking in GA4 is quite simple and much easier than it was in older versions of Google Analytics. By listing your domains in the GA4 interface, you ensure that user identifiers are transferred between sites, which prevents inflated user counts and ensures your marketing attribution data is accurate.
Keep in mind that this feature primarily works when visitors click standard hyperlinks (<a> elements). It may not work automatically for other interactions, like button clicks or form submissions.
Overall, correctly setting up CDT gives you a clearer, more complete picture of the full customer journey across all your websites. For more resources on GA4 and tracking tips, visit incisiveranking.

Follow Us:

About Us

We are experts in Tags and Tracking Services. With experience in eCommerce and Custom Conversion tracking, Server Side Tagging, and Data tracking to help you get the advantage of ACCURATE data for better decision making. With more than 6 years of experience, We have already delivered more than 500 projects.