How To Set Up Cross Domain Tracking

Cross domain tracking makes it possible for Analytics to see sessions on two related sites as a single session. It also helps you to better track your goal conversions. In this guide, we’ll show you how to implement cross domain tracking using MonsterInsights.

Why You Need Cross Domain Tracking

You need cross domain tracking when your Google Analytics session spans across two or more domains and you want to track the sessions across different domains as a single session.

Let’s take a detailed look.

Imagine that a user lands on your site from a PPC campaign, and then goes to your third-party shopping cart’s site like Shopify to complete the checkout process.

If you’re not implementing cross domain tracking on your site, here is how Google Analytics tracks ecommerce transactions.

  • It counts the same user as two different users and tracks this single session as two sessions.
  • Instead of crediting the PPC campaign for conversion, it simply tells you that someone from your site made a purchase. That means you can’t determine the original source of your goal conversion.

Another benefit of implementing cross domain tracking is that you can collect data from different domains in a single report.

Let’s take a look at how to set up cross domain tracking in MonsterInsights.

Turning on allowLinker

Before we get started, you’ll need to have the MonsterInsights plugin installed and authenticated with Google Analytics.

To enable allowLinker on your site, navigate to Insights » Settings » Enhanced Link Attribution. Then, click the checkbox to turn on allowLinker. Then, click Save Changes.

allowLinker

Insert a Custom Code

After turning on allowLinker, you’ll need to insert a custom code in the custom code snippet by navigating to Insights » Settings » Tracking » Compatibility.

Here is the custom code.


__gaTracker('require', 'linker');
__gaTracker('linker:autoLink', ['example-2.com'] );

custom code

Make sure to replace example-2.com in the code with the second domain you’d like to cross track.

If you want to cross track three or more domains, you can separate the domain names with a comma

__gaTracker('linker:autoLink', ['example-2.com', 'example-3.com'] );

Then, click Save Changes.

Verify Your Source Code for Cross Tracking

If you want to test whether cross tracking is implemented correctly, you just need to look at the source code of your site.

custom code tracking code

If you can find the custom tracking code in your Google Analytics source code, you’ve successfully implemented cross tracking on your site.