How to set up Cross-domain Tracking with Google Tag Manager

Author:

Setting up cross-domain tracking with Google Tag Manager (GTM) allows you to track user interactions seamlessly across multiple domains, providing a holistic view of user behavior. Here’s how to set it up:

1. Enable Cross-Domain Tracking in Google Analytics

Before setting up cross-domain tracking in GTM, ensure that cross-domain tracking is enabled in your Google Analytics (GA) property settings.

  • Sign in to your Google Analytics account.
  • Go to the Admin section.
  • Under the Property column, click on Tracking Info, then Tracking Code.
  • Scroll down to the Cross-Domain Tracking section.
  • Enter the domains you want to track under “Domains to be tracked as cross-domains.” Make sure to include the primary domain and any additional domains you want to track.
  • Save your changes.

2. Configure Cross-Domain Settings in Google Tag Manager

Next, configure cross-domain settings in GTM to ensure that tracking information is passed between domains correctly.

  • Sign in to your Google Tag Manager account.
  • Navigate to the container for your website.
  • Go to Tags and click on the tag you’re using to send data to Google Analytics (usually a Universal Analytics or GA4 tag).
  • Under More Settings, expand the Cross-Domain Tracking section.
  • Enable Cross-Domain Tracking.
  • Enter the Auto Link Domains. These are the domains where you want to maintain session continuity. Typically, this includes your primary domain and any additional domains you’re tracking.
  • Optionally, set up additional fields like Allow Linker to Decide and Use Hash as Delimiter, depending on your tracking requirements.

3. Adjust Links and Forms

For cross-domain tracking to work properly, all links and forms that lead users from one domain to another need to be modified to pass tracking parameters.

  • Update Links: Add the necessary JavaScript code to your links to ensure that tracking parameters are appended to the URL when users navigate between domains.It
  • Update Forms: If you have forms that redirect users to another domain upon submission, make sure to add JavaScript code to pass tracking parameters.

4. Test and Debug

  • Once you’ve configured cross-domain tracking in GTM, thoroughly test it to ensure that tracking information is passed correctly between domains. Use GTM’s preview mode to debug any issues and verify that tracking parameters are being appended to URLs and form submissions as expected.

5. Publish Changes

  • After testing and debugging your cross-domain tracking setup, publish your changes in GTM to make them live on your website.

By following these steps, you can successfully set up cross-domain tracking with Google Tag Manager, allowing you to track user interactions seamlessly across multiple domains.