Google Analytics

How to Set Up Cross-Domain Tracking in GA4

Getting Familiar with the Cross-Domain Tracking Process in GA4 + Multi-Platform Setup, Manual Cross-Domain Tracking & More

Main Image Courtesy of Travelpayouts

Site linking refers to the concept of cross-domain tracking, with the ultimate goal to unify a user's session across multiple domains in a single duration. Without this feature, a user who visits your site and then proceeds to another domain would be considered an independent user, with two distinct sessions.

Digital marketers can gain a deeper understanding of a company’s overall web performance and traffic with cross-domain tracking. This feature is commonly used by companies that operate a booking or shopping cart platform apart from their main domain.

Cross-domain tracking can help digital marketers evaluate the effectiveness of their paid media investments, particularly when it comes to analyzing the impact of social media ads and Google AdWords. It can also be beneficial for other forms of content marketing and SEO.

Companies may operate in multiple domains. For example, some companies will display their products on their main website but will sell them through an intermediary platform.

Using GA4, business owners can collect data for multiple domains and present this information in data reports. However, you can't view sessions that are continuously active as users go from one domain to another, because the session ends when the user leaves one domain.

One of the main differences between the older version of Universal Analytics and the newer version of GA4 is that you can now configure cross-domain measurement through the GUI instead of through JavaScript or implementation. First-party cookies are used in Google Analytics to track the activities of users, which are assigned a unique ID when a user visits your site.

When a user visits a site, Google Analytics will collect information about them through their unique ID. However, once a user changes the domain, the cookie stops sending data.

When a link is sent from one domain to another, the Cross-Domain Tracking feature appends a parameter to the destination. The parameter's hash is a representation of the client and session identifiers that the site will use when it sends traffic to another domain. This method allows the site to keep these details for future use.

Beginning the Set Up of the Cross-Domain Tracking Process 

In order for the process to work properly, all domains must have the same G-XXXXXXX measurement ID. This is necessary since cross-domain tracking doesn't work if all the domains don't have the same information stream.

In GA4, go to the Data Stream settings and click on the "More Tagging Settings" option. You'll then be able to configure your domains.

The _gl parameter is a crucial part of the URL's structure. If you don't see it, it means that you've either changed the settings for cross-site tracking or that there's something wrong with the link decoration.

The last step in testing is to compare the settings for the source and target domains. If you've got all the necessary technologies running on the same target and source domains, you should be able to see the matching values in the cookies.

If you're using a Google Analytics 4 configuration that's running on a target domain, the values for the _ga parameter should be the same as those for the source domain.

If you're a server-based Google Tag Manager user and you're collecting the same Measurement ID as the one for the source domain, you should see the same values in the cookies.

If you're using a Google Ads conversion tag on a target domain, the _gcl_aw cookie set should be the same as the one used on the source domain.

The goal of this testing is to ensure that the traffic coming from the target domain and the traffic coming from the source domain have the same identifiers.

If you see differences between the settings for the target and the source domains, then there might be an issue with the implementation.

Multi-Platform Setup 

GA cookies graphic
When cross-domain tracking is performed, the Google Analytics cookies on the target domain are substituted with the values of the source domain. This ensures that the concept of a session and user is consistent across both domains. Image Courtesy of MeasureSchool.

If you have already created cookies on the target domain and have a history of data collected using the identifiers, then those values may be erased.

If you have multiple trackers on the same target domain, then you should always ensure that they are not overwriting the identifiers in order to prevent cross-domain tracking.

This approach is different from what Universal Analytics suggested. In order to ensure that no pre-existing cookies are left unchangeable, the roll-up option should be renamed.

The cross-site linker in GA4 is only able to work with the default cookie, which means that if you are planning on implementing cross-domain tracking in Google Analytics 4, then you'll lose your local history. To prevent this, you should first copy the _ga cookie value to _local.ga before proceeding with the cross-site linking process.

If you want to start from scratch in Google Analytics 4, you can set the cookie_prefix parameter to some values. This will allow all the tags that use this configuration to have the same _ga cookie as the one you set.

Manual Cross-Domain Tracking in GA4

Setting up cross-domain tracking can also be done manually, if all else fails! (or that’s just the way you roll). Some people choose to configure it manually if they don't trust the automated settings.

Gtag.js graphic
There's a reason why Google Tag Manager and Gtag.js don't have a built-in API that allows us to generate the _gl parameter manually. This method would require a lot of work, as it will require you to build a query string and add cookie values to the outbound links. Image Courtesy of Analytics Mania

To implement cross-domain tracking, you need to create an event listener on the source site. It will listen for all relevant interactions and link clicks at the domains that you want to pass the data to.

When an event happens, you can set the listener callback's default action to not be redirected. You can then add the first-party cookies you want to pass to your target page as query parameters.

Next you can add a valid timestamp to the URL and load it with the relevant parameters in place. You can also use a simple fingerprint browser to perform this process.

On the target page, make sure that the timestamp is less than one minute old. Also, ensure that the browser is compatible with the current version. Before you add the values to the target page, run a script that will pull them from the URL and then write them to the first-party cookies.

Cross-Domain Tracking From an Aggregate Property 

To set up cross-domain tracking within a property, first you must first navigate to the settings section and click on the small gear icon located at the bottom left. The most important thing you need to know is the default URL, which is the primary domain of the property or website.

One of the most important steps to ensure that both domains are set as referral exclusion is to enter the Property Admin's list and add each one to it. Doing so will prevent cross-domain traffic from being recorded. This is because if one user visits the eComm store's main site and then goes to the other site, then that user's traffic will not be considered as referral traffic.

After setting up the excluded domains, the next step will be to enable and set up dedicated views for each one of them. This will allow us to analyze and review the performance of the websites individually.

One of the most efficient ways to analyze and review the performance of the websites is by creating a single primary view that will allow you to analyze and monitor the various aspects of the site. This method does not have historical data, but you can also segment the website's performance into individual domains.

Creating separate views for each domain ensures that the data collected from the site stays protected. This will allow you to add filters and see detailed information about the site.

Creating Segments

Another precise way to view the various performance of a website is by creating Segments within Google Analytics, which allows you to track the data from a specific domain. For example, you can set a condition within a segment that will allow you to capture data from that domain.

Unfortunately, the Site Content data may not be as filtered as you would expect. This is because some people may visit both sites at the same time, and this occurs even though the specified condition has been met.

Audience segmentation in GA4
Although segmentation provides a clear representation of a domain's specific data, it does not always reflect all of its elements. For instance, you may still see some overlap between the two domains. Image Courtesy of Analytics Mania

Although it's a good idea to create a segment within Google Analytics, it might not be the best solution for every situation. For instance, if you're planning on reporting on a site, you might want to use Data Studio to create a custom dashboard that will allow you to split the data into multiple segments. This will allow you to focus on more meaningful data.

Issues That Can Arise During Cross-Domain Tracking 

A problem with cross-domain tracking is that it can cause data collected from other channels to be deflated or distorted. This usually occurs when a user hops between multiple websites, which can result in duplicated and rerouted data being sent as traffic.

One of the most common issues that cross-domain tracking can encounter is when two sessions are sent from the same source. This can happen if both sources are using the same tracking strategy. In addition, if a multi-domain tracking method is not implemented with referral exclusions, inaccurate sessions can occur.

One of the most important steps that Google Analytics users should take when it comes to cross-site traffic is ensuring that both domains use the same property. There are several unique attributes of each property, and client IDs should not be shared between the two websites.

Client IDs of domains do not track the link parameters of the other website. Cross-domain tracking can be performed simply by adding the GA parameter to the source page’s URL, and doing so ensures that the users who are visiting both sites are the same one.

Get Started with Cross-Domain Setup Today

While cross-domain tracking can certainly provide its fair share of issues in GA4, it is the process most businesses take to improve their customer data collections to make further decisions that are best for the business overall. It tells you exactly how a user travels from one domain to the other, and gives you exactly what you need to properly take a look at all of the analytics. Need more assistance? You can always check out Google Support’s page for some more information! 

Newsletter
Get great insight from our expert team.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
By signing up you agree to our Terms & Conditions