How to Set up Cross-Domain Tracking in Google Analytics 4?
Cross-domain tracking is an essential part of any successful digital marketing strategy. It allows a website visitor’s activity on multiple domains or subdomains to be tracked as a single session, providing more accurate data and insights into how visitors navigate your website. And if you are familiar with cross-domain tracking in UA, most of the configuration is done on the code level (e.g., in gtag.js) or in GTM (GA tags). Because of that, many marketers and web analysts felt confused about what to do and where. In this guide, we’ll show you how to configure cross-domain tracking in Google Analytics 4.
Table of Contents:
- The Problem of Domain Tracking
- What is Cross-Domain Tracking in GA4?
- How Does Cross-Domain Tracking Work in GA4?
- Cookies and Cross-Domain Tracking
- How to Set up Cross-Domain Tracking in GA4?
- How Do You Know that Cross-Domain Tracking is Enabled?
- URL Redirects
- Final Words
- With cross-domain measurement, cookies retain the same as IDs. They’re passed from one domain to another via a URL parameter when a user navigates between domains through a link or a form. As a result, Analytics recognizes one user and one session.
- Without cross-domain measurement, new cookies with new IDs are created for each domain a user visits. As a result, a single user that visits different root domains on the same device will be identified separately (two users and two sessions instead of one user and one session).
- Navigate to your GA4 property and click Data streams in the Property column
- Once a new overlay appears, select Data Streams
- On the right side of your screen, you’ll see all data streams linked to your account; these are your websites and applications
- Select the necessary data stream and click Configure tag settings
- Next, choose to Configure your domains
- Here you should Include all domains for the cross-domain setup by clicking Add condition
- Select Contains in Match type and add your domain to Domain box
- Then repeat the process starting from Add condition to incorporate your second domain and click Save
- Open the website page that contains a link or a form that points to a domain your set up for cross-domain measurement
- Click the link or submit the form to go to the destination domain
- Make sure that the URL in the destination contains the linker parameter _gl
- ga_session_id
- page_location
The Problem of Domain Tracking
If your web property spans across multiple domains or subdomains, Google Analytics will consider visits in the same session to multiple domains as multiple sessions. So you need to configure cross-domain tracking if you’d like to use a single session as a user transitions between domains. Once you’ve done it, Google Analytics will automatically add a GET parameter “_ga4” to links from one site to another. The challenge with running GA4 and UA simultaneously is that only one configuration set can be applied simultaneously. One of these configurations is the list of domains to include and exclude, and the GA4 settings surpass UA.
What is Cross-Domain Tracking in GA4?
Before proceeding with the configuration guide, let’s say a few words about cross-domain tracking. If you’re already familiar with GA4 and have experience with multiple domains, skip this section and move on.
Cross-domain tracking in Google Analytics 4 (GA4) is a method for maintaining the same user identity across multiple domains. This ensures that all user activity from various domains is accurately linked to the same individual and reported similarly. Cross-domain tracking makes it possible to track website interactions regardless of where customers go next, enabling businesses to understand customer behavior better and improve their overall user experience. This information allows companies to develop effective marketing strategies based on real data insights.
How Does Cross-Domain Tracking Work in GA4?
If a visitor travels from domain 1 to domain 2, GA4 will pass a specific parameter to the domain 2 URL. With the help of this parameter, Google Analytics on domain 2 will update GA4 and understand that it’s one person navigating between two websites.
Note that if you track different websites that belong to the same domain, Google Analytics 4 will handle them automatically. And you don’t need cross-domain tracking for that.
Cookies and Cross-Domain Tracking
When there’s consent, Google Analytics uses first-party cookies to set IDs for each unique session.
Note that this setup isn’t required for subdomains as they share the same cookies with the root domain (except when you change the default cookie domain configuration).
How to Set up Cross-Domain Tracking in GA4?
In the case of Google Analytics 4, setting up cross-domain tracking has been made simple compared to Universal Analytics, where hardcoded tagging was required. Now it can be configured in the Admin section.
Note that you’ll need an Editor role to set up cross-domain measurement.
If you have cross-domain tracking in Universal Analytics, you should verify that the same domains are tracked in GA4.
Google Analytics 4: An Introduction to Predictive Metrics
How to Connect Google Looker Studio and GA4?
Understanding Predictive Audiences in GA4
How Do You Know that Cross-Domain Tracking is Enabled?
To verify if cross-domain measurement is working properly, follow the next steps:
Another way to test your configuration is to install and enable the Google Analytics Debugger and go to the DebugView of GA4.
Then go back to your first website and reload the page. You’ll see a page_view event that would have occurred around the same time you visited the page.
Click on it, and details related to the event will pop up. Under Parameters, take note of the following:
The ga_session ID is a unique parameter, and it must remain the same when you click a link that sends you to the other domain. The page_location parameter should be for the second domain. These are the results you should be looking for.
URL Redirects
If the destination page redirects or doesn’t support arbitrary query parameters, the parameter _gl might be removed from the URL even if it was added by Google Analytics on the previous page. To confirm this is happening to your website, check the network requests made by the previous page using the Chrome Developer Tools. Configure your website to preserve the parameter _gl in redirects to fix this issue.
Final Words
By following these steps carefully, anyone can set up cross-domain tracking in Google Analytics 4 (GA4). Doing so will give website owners valuable insights into how their visitors navigate across different domains and subdomains, allowing them to optimize their digital marketing efforts more effectively than ever. As always, if there are any questions about setting up cross-domain tracking in GA4, please feel free to reach out — we would love to help!
Get in touch
Got a question? We'd love to hear from you. Send us a message and we'll respond as soon as possible.
By clicking submit, you agree to our Privacy Policy
Latest Insights
Get the tips from our experts to optimize and scale your campaigns