Download

Documentation

Print This page

How To Setup Cross Domain Tracking In WordPress

Cross-Domain tracking makes it possible for Google Analytics to track the sessions on two related websites as a single session.

Cross-Domain tracking helps you better track your visitor cycle across the domains. For tracking the users across multiple domains in Google Analytics, Google recommends using the official Linker plugin instead of setting up Cross-domain tracking yourself.

But the downside is it requires coding, and you surely don't want to mess up the code!

So, at Analytify, we have added an easy way for you to set up cross-domain tracking. Here, we will discuss how to set up cross-domain tracking in WordPress.

We support analytics.js i.e Universal Analytics tracking only as Traditional ga.js tracking has been deprecated by Google.

Steps: How To Setup Cross Domain Tracking In WordPress

Let's say you have 2 websites with the name source.com and destination.com.

1. The first step is to install and set up Analytify on both WordPress websites.
2. Log in to your WordPress website dashboard.
3. Navigate to Analytify–>Settings.
4. Now click on the Advanced option in the Settings window.
5. Now Enable the Setup Cross-domain Tracking option from No to Yes.
6. Now add the given snippet code and click on the Save Changes button.

Note carefully about the code snippet added in Custom JS Code text areas.

You have to link each website to its connected websites. e.g.

On source.com:
ga('linker:autoLink', ['destination.com']);

On destination.com:
ga('linker:autoLink', ['source.com']);

Note: Do not add http/https with the domain name.

Plugin Settings (Advanced Tab) for source.com

Plugin Settings (Advanced Tab) for destination.com

What If You Want To Set Up Cross-Domain Tracking On Websites NOT On WordPress?

Check out the  following example:

Let say you have two sites i.e. site-1.com and site-2.com Not on WordPress. To integrate the cross-domain tracking add the below code in the header of each site respectively. Remember to include the Google Analytics code snippet as well.

On site-1.com:

ga('create', 'UA-XXXXX-Y', 'auto', {allowLinker: true});
ga('require', 'linker');
ga('linker:autoLink', ['site-2.com']);

On site-2.com:

ga('create', 'UA-XXXXX-Y', 'auto', {allowLinker: true});
ga('require', 'linker');
ga('linker:autoLink', ['site-1.com']);

This is how you can easily implement the Cross-Domain tracking