GA4 Cross Domain Tracking: A Know it all Guide

Introduction

Google Analytics is a powerful tool that helps businesses track and analyze their website traffic. However, tracking multiple domains can be tricky, as each domain is treated as a separate entity by default. This is where cross-domain tracking comes in. In this article, we will explore what cross-domain tracking is, why it is important, and how it works.

Why Do You Need Cross-Domain Tracking?

Tracking multiple domains in one Google Analytics property is useful for businesses that have multiple websites that they want to track as a single entity. By default, when a user visits multiple domains in one property, each domain drops its own unique cookie for that user. This means that if a user goes from one domain to another, Google Analytics will report two separate sessions. This can result in inaccurate data and can make it difficult to track the user journey as a whole.
If you do not have cross-domain tracking configured:

  • You won't be able to tell which of your marketing initiatives is generating sales or conversions.
  • Your GA4 reports will be significantly inflated. They will display more users and sessions than are actually present. This occurs because each visit from the first to the second website counts as a new user with a new session.

What Does Cross-Domain Tracking Do?

Cross-domain tracking allows businesses to combine the user journey under one session, even if the user visits multiple domains. This is achieved by passing user and session information from one domain to another via a URL parameter identified by the key _gl:.

When a user navigates from one domain to another, the _ga cookie information is passed from the first domain to the second domain via a URL parameter identified by the key _gl:. This enables Google Analytics to link the user and session information across domains and treat them as a single entity.

To enable cross-domain tracking, you need to add the domains you want to track to the referral exclusion list in your Google Analytics property settings. This tells Google Analytics to ignore referrals from those domains and treat them as part of the same session.

How do I add another domain to Google Analytics 4 for cross-domain tracking?

It is essential to ensure that the GA4 Property is installed on all the websites that you want to track. This requires the installation of the same measurement ID on every domain. The presence of a measurement ID signifies that you have already installed Google Analytics. If you are unaware of how to create an account or install GA4 using Google Tag Manager, it is recommended that you refer to a resource that explains the process of upgrading to Google Analytics 4. It is crucial to have the same GA4 Property and measurement ID on all websites to gather accurate and comprehensive data about your online activity. By following the recommended steps, you can easily upgrade to GA4 and track your website's performance efficiently.

While this is explained quite clearly in the official documentation, below are the steps as well: 

  • Go to the admin panel of the GA4 property.
  • Click on Data Streams (under property)
  • Click on the data stream that you want to enable cross-domain tracking for.
  • On the next screen (streams details), scroll to the bottom and click on "Configure Tag Settings”

  • On the next screen (More tagging settings), click on "Configure Your Domains"
  • On the next screen, click on "Add Conditions" and add your domains using one of the match types i.e. contains, exactly matches, regex, begins with or ends with.
  • Once done, hit "Save"

Your cross-domain tracking is ready. Make sure to use the same Measurement ID for both sites.

How do I Set Up Cross-Domain Tracking for Subdomains?

GA4 automatically tracks subdomains. As a result, you won't have to go through the identical procedure we discussed earlier.

Let's have a look at how subdomain tracking appears in GA4 to see how it works in practice.

Subdomains allow you to build separate sections (as well as separate linked pages) of your website. This is frequently the case with blogs, online storefronts, or regional material that must be arranged differently while being linked to a single main site.

For example, let’s say that you own a website called www.mysite1.com. 

If you serve different countries with varying offers, your subdomains may look like www.australia.mysite1.com or www.india.mysite1.com.

🚨 Note: Remember that you don’t have anything to configure for subdomain tracking. You should not add your subdomain or domain in the section Configure your domains. 

How to ensure cross-domain tracking was setup correctly and enabled?

To determine if cross-domain tracking is working, you should check several factors. Here are some steps to help you confirm that cross-domain tracking is set up correctly:

Check the tracking code: First, ensure that your tracking code is set up correctly on both domains. You can check this by reviewing the code on each website's source code to make sure that the same tracking ID is being used on both domains.

Check the referral source: When a user moves from one domain to another, the referral source should reflect the previous domain. You can verify this by checking the referral source in your analytics tool. If the referral source is correct, it means cross-domain tracking is working correctly.

Check session continuity: Session continuity refers to the ability to track the same user across multiple domains as a single session. You can verify this by checking the session ID in your analytics tool. If the session ID remains the same as the user moves from one domain to another, it means cross-domain tracking is working correctly.

Check cross-domain events: If you have set up any cross-domain events, such as tracking clicks on links that take users from one domain to another, make sure that these events are being tracked correctly in your analytics tool.

Test and validate: Finally, you should test and validate your cross-domain tracking by visiting both domains and performing actions that trigger events. For example, you can visit the main website, add a product to your cart, and then navigate to the online store to see if the cart data is still present. If the data is present, it means cross-domain tracking is working correctly.

FAQs

How Does Cross-Domain Tracking Work?

Google Analytics identifies users by assigning each a unique client ID and session ID. Both of them remain consistent as the users visit another website where cross-domain tracking is implemented. Without this linking feature, a visitor going from one site to another will be considered two different people (specifically two different browsers or devices).

Do Subdomains Need Cross-Domain Tracking in GA4?

If you have the same GA4 Measurement ID on all the subdomains, you don't need cross-domain tracking. Cookies are created by default in your main domain and also remain in your subdomains. This means that Google Analytics can track users across your subdomains without the need for cross-domain tracking.

Do You Need to Configure the Referral Exclusion List for Cross-Domain Tracking in GA4?

No, this is not needed. Once you have set up the domains, GA4 will automatically take care of this aspect for you. However, there are some exceptions to this rule.

It is recommended to add any third-party domains that are involved in the transaction process or that manage key interactions to the referral exclusion list. These could be payment gateways such as PayPal or email marketing platforms that send password recovery steps to your email list. By doing so, you can ensure that the traffic from these domains is not counted as referrals in your analytics.

There may be some unusual cases where your domain appears in the referral report. In such situations, it is advisable to add your domain to the referral exclusion list.

Additionally, it is useful to create a source/medium report in GA4 to examine which channels are passed as referral traffic. This report can help you gain insights into how users are arriving at your site and which channels are driving the most traffic.

In summary, configuring the referral exclusion list for cross-domain tracking in GA4 is not necessary. However, adding third-party domains and your own domain to the list can help ensure accurate tracking and reporting. Creating a source/medium report can also provide valuable insights into your website's traffic sources.

What to Do If Cross-Domain Tracking Isn't Working after following all the mentioned steps?

If you notice that the _gl parameter is missing from the URL of the destination domain, you need to ensure that the domain matches the one configured in the "Configure your domains" section. If this doesn't solve the issue, it's likely that the problem arises from prior configurations made on the destination domain, which could be due to URL redirects or conflicting scripts. In such cases, you would need the assistance of a developer to troubleshoot the problem.

If your destination domain has a redirect or quickly removes the _gl parameter that was added to the URL, you can address this problem by asking your developer to ensure that the parameter _gl is not dropped.

Regarding conflicts with other scripts, a method in javascript such as the Event.stopPropagation() can be used to prevent the event from bubbling up the Document Object Model (DOM). To explain, when a user clicks on a link, this information and any related data will move through a series of HTML elements to reach an event listener that waits to receive it. However, sometimes certain scripts prevent this information from reaching the listener, leading to the issue.

Therefore, it's important to identify the cause of the problem and seek assistance from a developer to fix it. By ensuring that the _gl parameter is not dropped and using methods such as Event.stopPropagation(), you can prevent conflicts with other scripts and ensure that your links and related data are successfully transmitted to the event listener.

Conclusion

Several individuals find the GA4 characteristics to be as clear as mud. This is not the case with cross-domain tracking. This feature is significantly easier to configure than its predecessor GA3.

But, there are a few drawbacks to be aware of that may obscure the true story behind your data.

Cross-domain tracking in Google Analytics 4 is an essential feature that helps you understand how users interact with your website across different domains. It's easy to set up and doesn't require much technical expertise. However, if you encounter any issues with cross-domain tracking, don't hesitate to seek help from a developer.

You can also check out our blogs on the key features of GA4 and GA4- From a Business owner’s perspective to better understand GA4 and adapt timely as well as effectively to GA4. Alternatively, you can also check out Our Offerings in terms of GA4, if you’d like to explore the option of us coming in and doing it for you.

Get in touch with us

Don’t worry about making a large commitment without knowing much about what we can offer. Book a call with us, help us understand your business and then we’ll offer you a free ad account audit and an actionable marketing strategy. Like the strategy? Hire us! Don’t want to hire us? No problem. The strategy is on us!
Book Intro Call

Best Part?

Are you a digital business looking to win the BFCM (Black Friday Cyber Monday) this Thanksgiving? Get in touch with us and we’ll send over a free guide on the best BFCM myth-busters!

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.