Convertmind knowledge base
Cross domain tracking, also called site linking, is a process where Google Analytics is set to track activity from two separated but related websites under one umbrella. This means if that one user goes from the first site to the second one, it’s still counted as one session. This can be very useful when there are essential pages in your funnel that are hosted under a different domain.
Normally, Google Analytics tracks any traffic within a certain URL. For example, if Google Analytics is set to track ‘convertmind.com’, it will freely track all traffic that happens within that domain. What pages users visit, how long they’re on the site, how many sessions they have, it’s all recorded.
However, when it comes to separate URLs, Google Analytics normally treats them as a completely separate thing. Unless a user comes to your site via a referral link, Google Analytics generally doesn’t care too much about external URLs. This means that normally, your tracking is limited to one URL. Keep in mind: this goes for subdomains as well. Do you want to track both convertmind.com and blog.convertmind.com? By default, Google Analytics treats them as separate sites.
Cross-domain tracking can solve this. With cross-domain tracking, you can continue tracking users across various domains and URLs within the same session. This can give you valuable insight into how users truly behave when your funnel requires multiple domains.
For example, imagine you are running various smaller ecommerce sites, but for payment users need to go to your main site. Using cross-domain tracking, you can then continue to track them from your ecommerce site to your main site and back. All interactions will be counted as a part of one session and one user, rather than it being separated.
With Convertmind we chose to run seperate views for blog.convertmind.com and convertmind.com.
Setting up cross-domain tracking can be a little complicated. For one of the methods, some knowledge and experience regarding HTML and JavaScript is recommended. If you don’t feel you’re comfortable tinkering with your site’s code, it’s recommended to get help from an expert in web development.
You can set up cross-domain tracking two ways: via Google Tag Manager and by editing your site’s code.
You can set up cross-domain tracking in Google Analytics with Google Tag Manager by setting up a Universal Analytics tag. You can do that by following these steps:
If everything’s been done correctly, cross-domain tracking should now be set up.
If you don’t use Google Tag Manager, you will have to modify the Analytics code on each domain you want to cross track in order to allow this.
Fist of all, you need to set up one property in your Google Analytics account. The same code snippet and ID from that property will be used for all of the domains you’ll be cross tracking.
Cross-tracking two domains
Open your snippet in your code editor of choice. A regular text editor like Notepad works too.
In this example, we’ll be using example1.org as the primary domain, and we’ll be using example2.org as the domain we want to cross track with.
First, we’ll be editing the code for the primary domain. Find the create line in the snippet. The create line looks like this:
ga(‘create’, ‘UA-XXXXXXX-Y’, ‘example1.org’);
Keep in mind, UA-XXXXXXX-Y here represents your Google Analytics ID. You’ll need to make some adjustments to the code. In the code below, the adjustments are marked green. Change the code, so it looks like this:
ga(‘create’, ‘UA-XXXXXXX-Y’, ‘auto’, {‘allowLinker’: true}); ga(‘require’, ‘linker’); ga(‘linker:autoLink’, [‘example2.org’]);
ga(‘create’, ‘UA-XXXXXXX-Y’, ‘auto’, {‘allowLinker’: true});
ga(‘require’, ‘linker’);
ga(‘linker:autoLink’, [‘example2.org’]);
Don’t forget to put your own Google Analytics ID in place of the placeholder (UA-XXXXXXX-Y). Save this as the code for your primary domain.
Next, we’ll be creating the code for the secondary page. For this, take the same basic code we started with:
ga(‘create’, ‘UA-XXXXXXX-Y’, ‘example1.org’);Make the following adjustments: ga(‘create’, ‘UA-XXXXXXX-Y’, ‘auto’, {‘allowLinker’: true}); ga(‘require’, ‘linker’); ga(‘linker:autoLink’, [‘example1.org’]);
Make the following adjustments:
ga(‘linker:autoLink’, [‘example1.org’]);
Notice how we’re using the URL for the second page in the code for the first page, and the URL from the first page in the code for the second page. This is correct and how it should be done. It’s easy to get confused and mix these up though, so be wary.
Save this code as the code for the second site you’re tracking.
Once this is all done, simply implement the code on the respective sites, and you’re ready to go!
Cross-tracking three or more domains
Setting up cross-domain tracking for three or more domains isn’t much more complicated than setting up tracking for two domains.
In this example, we’ll be using example1.org as the primary domain, and we’ll be using example2.org and example3.org as the domains we want to cross track with.
ga(‘create’, ‘UA-XXXXXXX-Y’, ‘auto’, {‘allowLinker’: true}); ga(‘require’, ‘linker’); ga(‘linker:autoLink’, [‘example2.org’, ‘example3.org’]);
ga(‘linker:autoLink’, [‘example2.org’, ‘example3.org’]);
Don’t forget to put your own Google Analytics ID in place of the placeholder (UA-XXXXXXX-Y), and to replace the example URLs with your own.. Save this as the code for your primary domain.
ga(‘create’, ‘UA-XXXXXXX-Y’, ‘example1.org’);Make the following adjustments: ga(‘create’, ‘UA-XXXXXXX-Y’, ‘auto’, {‘allowLinker’: true}); ga(‘require’, ‘linker’); ga(‘linker:autoLink’, [‘example1.org’, ‘example3.org’]);
ga(‘linker:autoLink’, [‘example1.org’, ‘example3.org’]);
The code for page number three follows the same pattern. We start with
And we adjust it to this:
ga(‘create’, ‘UA-XXXXXXX-Y’, ‘auto’, {‘allowLinker’: true}); ga(‘require’, ‘linker’); ga(‘linker:autoLink’, [‘example1.org’, ‘example2.org’]);
ga(‘linker:autoLink’, [‘example1.org’, ‘example2.org’]);
With this same structure, you can add as many URLs as you want. Just make that in the code for every domain, you correctly refer to all other domains. Also make sure you structure the code correctly, with a comma and a space between every URL and apostrophes around every URL.
Once your code is ready, simply implement your code on the respective sites, and you’re ready to go!
Google Analytics, by default, leaves out the domain name in reports. For example, when the URL tracked is convertmind.com/beta, Google Analytics will only show ‘/beta’. For single domain tracking, this is handy because it removes a lot of clutter. However, when you’re using cross-domain tracking, you may want to know which domain the listed page is from. Thankfully, Google Analytics does allow you to do this.
To start, create a copy of your reporting view that includes data from all of your domains:
Next, create a new advanced filter for that view. This filter will instruct Google Analytics to not hide the domains from you and your reports. In order to do this, follow these steps:
If you’ve done everything correctly, then the new view should allow you to see the domains in your reports.
Once you’ve configured cross domain tracking properly it is time to test. All traffic from domein A to domain B should be part of the same session. So it should show in the same Source/Medium dimension.
It is our advice not to use Real Rime reports from Google Analytics to test the cross domain tracking. Real Time shows each hit only with parameters and dimensions by the hit itself. It means that you can’t view the test session in Source/medium Real Time. You’ll need to wait for the data in the standard reports.
It is easier to verify Cross Domain tracking with custom UTM parameters like this:
www.domainA.com/?utm_source=optimizer_test&utm_medium=optimizer_test&utm_campaign=optimizer_test
While stille browsing Domain A open a second page (tab) with Domain B. The Cross Domain session should be active.
in the Google Analytics View you can now apply a segment to include only your UTM traffic from above.
Once the data hits Google Analytics, you are able to find your session when when applying your optimizer_test segment.
Let smart algorithms audit your Google Analytics data. Find hidden conversion leaks and increase your conversions.
Create account