For tracking the users across multiple domains in Google Analytics, It is being recommended by Google to use the official Linker plugin instead of setting up Cross-domain tracking yourself. So, at Analytify, We have added an easy way for you to set up cross-domain tracking. Here, we will discuss How to Setup 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.
Let's say you have 2 websites with the name source.com and destination.com.
The first step is to install and set up Analytify on both WordPress websites as shown below in pictures.
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.
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.
ga('create', 'UA-XXXXX-Y', 'auto', {allowLinker: true});
ga('require', 'linker');
ga('linker:autoLink', ['site-2.com']);
ga('create', 'UA-XXXXX-Y', 'auto', {allowLinker: true});
ga('require', 'linker');
ga('linker:autoLink', ['site-1.com']);