Your guide to Cross-Domain Tracking

Cross-Domain Tracking is a powerful tool that enables website owners to track user behavior and engagement across multiple domains. It is particularly useful for businesses that have multiple websites or subdomains, as it provides a clearer view of user behavior and helps to identify areas for improvement. However, setting up cross-domain tracking can be a complex process, and many website owners are not familiar with the steps involved. In this article, we will provide you with a guide to cross-domain tracking and how you can set it up for your website.

What is Cross-Domain Tracking:

Cross-domain tracking is a technique used in web analytics to track a user’s activity across multiple domains or subdomains. The process involves using cookies to capture information about a user’s activity between different domains, this allows website owners to gain a more accurate understanding of user behavior and engagement on their site. The information can then be used to make data-driven decisions to improve a website’s performance and drive business growth. 

GA4 & GTM are great tools to use for cross-domain tracking. GA4 uses a first-party cookie called _ga. When a cookie is set up for your domain in GA4 it will store information about a visitor’s behavior on your site. By creating a cross-domain measurement configuration, you are setting up cookies that will communicate a user’s information and behavior to each other and in turn you will be able to see how a user navigates and behaves across different domains & subdomains.

In this manual, you will learn about cross-domain tracking, cookies & how to set them up.

What are Cookies, how do they work & what do they do?

Website cookies are small text files that are stored on a user’s device when visiting a website. They contain information about the user’s website interactions that are used to remember user information and provide personalized experiences. There are different types of cookies, such as session cookies and persistent cookies, that are used to store information temporarily or permanently.

Cross-Domain tracking using GA4

Cross-domain tracking in GA4 allows website owners to track user activity across multiple domains, providing a more accurate understanding of user behavior and engagement. In order to set up cross-domain tracking in GA4, we will look at the following:

 

  1. Create a new GA4 property and data stream for your website, if you haven’t already.

2. Set up cross-domain measurement 

  • Go to the “Admin” section of your GA4 property. 
  • Select “Data Streams”.
  • Choose the data stream for your website. 
  • Under “Measurement Settings,” click on “Cross-domain measurement” & turn it on.

 

3. Add your domains to the cross-domain measurement list by clicking on “Configure cross-domain tracking” and entering the domains you want to track.

4. Modify the tracking code on each domain by adding the same GA4 measurement ID and linker code with the domain names specified in the cross-domain measurement list.

5. Test your cross-domain tracking setup by navigating between the domains and checking if the tracking code is passing cookie information back & forth.

6. Verify that cross-domain tracking is working correctly in your GA4 reporting by checking if you’re seeing data from all the domains you’re tracking.

Google Analytics 4 uses a first party cookie called _ga. The _ga cookie stores information about the user & their session and has the following attributes:

Cookie Name – This is the name of the cookie – “_ga” by default

Cookie Domain – This is the domain at which the cookie is set up. For example – the domain without the ‘www’ prefix (so instead of “www.greatsite.com”, it will be “greatsite.com”.) 

Cookie Path – This is the path at which the cookie is set up. A.K.A the root directory of the domain, which is “/”.

Cookie Expires – The time in seconds after which the _ga cookie expires. By default, a cookie expires 2 years after the last time it was refreshed.

First Party Cookies can’t share this type of information with other domains. This is where Cross-Domain Tracking comes into play. In a case like this, we need to instruct Cookie “A” to share the values of Site “A” with the Cookie “B” for Site “B”. 

This will add _ga cookie values to the URLs where the domain changes using a query string by default. You can also change these to URL Fragments if you don’t want to use query strings. GA4 will recognise these added parameters in these URLs & ensure that the GA4 cookie adopts them.

What are Subdomains?

Cross-Domain Tracking often gets confused with Subdomain Tracking. A Subdomain is a subdivision of a domain that helps split up different areas of a website when used correctly. 

When these domains aren’t structured correctly, then measuring what users do on your website will be severely impacted. Data won’t be captured correctly in GA4 & it will therefore be impossible to make decisions based on your findings.

In some cases, Cross-Domain Tracking is not possible due to not being able to implement GA4 onto a domain/s. Such a scenario is applicable to payment gateways – you can make use of GA4’s referral exclusion list which can be accessed via the GA4 admin panel.

Cross-Domain tracking using GTM

Using GTM, you can quickly & easily set up this process. Cross-domain tracking is set up using your GA4 pageview tag. Look at the ‘More settings’ menu for this feature. Expanding this exposes numerous tools we can tinker with. However, to set up Cross-Domain Tracking, we will only focus on two of the 7 additional settings, these are ‘Fields to Set’ and ‘Cross-Domain Tracking’.

  1. Within ‘Fields to Set’ we will add two fields. These are ‘allowLinker’ and ‘cookieDomain’. We are going to set our allowLinker to ‘true’ and then GA will decide which is the best cookie domain to use by setting it to ‘auto’. Please see the below screenshot for reference.

2. Next we are going to take a look at ‘Cross-Domain Tracking’ further down the page. Here you will find 1 field that you need to fill out and two drop-down menus which are optional.

We will be using the ‘Auto Link Domains’ field to tell our tag which domains we want to track as part of cross-domain.

‘Use Hash as Delimiter’ dictates whether the cookie values will be added to the url using either a query string or a URL fragment:

  • ‘Use Hash as Delimiter’ set to ‘False’: http://www.siteb.com/?_ga=1.123456789.9876543210.123456789
  • ‘Use Hash as Delimiter’ set to ‘True’: http://www.siteb.com/#_ga=1.123456789.9876543210.123456789

The use of each depends on a case by case basis. It really depends on how the website has been built. Query strings are used by default. If this breaks the site then use the url fragments or if you don’t want to use Query Strings. If neither works, you will need to communicate this with the developer who has built the site in order to find a solution. 

Setting ‘Use Hash as Delimiter’ to true will not affect the usage of other URL Fragments or Query Strings.

‘Decorate Forms’ should be used when you have a form that does cross-domain submission.

3. Once you have successfully configured your tag and tested it thoroughly, (especially on websites built on older platforms!) create a new version in GTM and publish the changes.


4. The next step you need to take is to go into GA4 and add the second domain that you want to track to the referral exclusion list. This is found in the Admin section in the middle column under ‘Tracking Info > Referral Exclusion List’.

To implement cross-domain tracking, the quicker and easier option is to use Google Tag Manager.

Here is a 5-Step Guide you can use for Cross-Domain Tracking

Understand the limitations of cookies: Cookies track users across domains, but limitations must be taken into account. Cookies are only sent to the server for requests that match the specified path, domain, and protocol. If a user navigates to a different domain, the cookie will not be sent to the new domain. Some web browsers may also block or limit cookies, which can impact tracking accuracy.

Use the same tracking code across domains: It is important to use the same tracking code on all domains. Use a third-party tracking tool, such as Google Analytics 4 or Adobe Analytics. These tools provide tracking codes that can be added to each website, allowing for cross-domain tracking.

Configure Cross-Domain Tracking in the tracking tool: It is important to configure Cross-Domain Tracking in the tracking tool once a tracking code has been added to each website. It typically involves setting up Cross-Domain Linking or Cross-Domain Tracking in the tool’s settings. This allows the tool to track users as they navigate between domains, even if cookies can not be transferred between domains.

Consider other tracking methods: There are other tracking methods that can be used for Cross-Domain Tracking besides cookies. For example, URL parameters can be used to track users across domains. This involves adding a unique identifier to the URL when the user navigates to a different domain. This identifier can then be tracked on the server to determine how users move between domains.

Test and validate the tracking: Test and validate the tracking once the setup is done to ensure that it is working correctly. This can involve using testing tools or performing manual tests to confirm that the tracking data is accurate.

In conclusion, cross-domain tracking can provide valuable insights into user behaviors across multiple domains or websites. 

By understanding the limitations of cookies and following the steps mentioned above, website owners can effectively track user behaviors across multiple domains, capture insightful views and implement data driven decisions to better understand their target audience, provide a better user experience and leverage their online presence.

Do you need an agency to do the heavy lifting for you? 

Look no further than Skylight-Digital!

We have been specializing in Digital Marketing for over 13 years and have collective experience of over 46 years. Let us set up your cross-domain tracking for your website and help you leverage your business! 

Digital marketing,

with a focus on lead generation…

Looking for an affordable investment? We use a powerful combination of predictive data along with our Google marketing skills to ensure your company’s chances of being found on the first page of Google Search Results is great.

We strategically place your website & product offering in front of an active, relevant & location targeted audience, to send you qualified leads that your sales team can engage with.

The Google Display network is then used to follow users who did not convert, and remind them of your value proposition. Our in-depth understanding of website data ensures that the quality of leads constantly improves.

The end result: A campaign that gives you a good return on investment. The cool kids call it ROI. Then, take your digital capabilities to the next level with our range of add-ons that will ensure you stay ahead of your competition.

Make a booking today!

Subscribe to our Newsletter

Share this post with your friends

Leave a Reply

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

your-guide-to-cross-domain-tracking-skylight-digital

Get Your Free SEO Starter Pack Here

Download our free SEO Guide for everything you need to know about optimizing your website for SEO in South Africa!

STSP
Bobby
Keen to chat?
Lets discuss your needs