Cross Domain Tracking makes it possible for Google Analytics to connect sessions on two related sites and make it a single session.
How is this beneficial to your company? It allows you to understand how users navigate through your web properties so you’re able to see a complete user journey.
Some examples of how this might relate to you:
Typically if a user was on your website and clicks on your blog which resides on a separate domain, Google Analytics would start a second new session once they reach the blog. With Cross Domain Tracking, Google Analytics will recognize the Client ID from your main site and will pass it on to your blog (or other domain/ subdomain) so that you are able to see how users navigate through your website.
Now that we understand what Cross Domain Tracking is, how do you implement it?
First you want to start in Google Tag Manager. Once logged in, click on Variables in the left hand menu and then New to create a new Variable.
Here we will create a Cross-Domain Variable. As a best practice always name your Variable first.
Next we are going to choose a variable type to set-up. The variable type we will be using is located under Utilities and is the Constant variable type.
Next we are going to insert the two domains we would like to set-up with Cross Domain Tracking. This goes into the Value section of the variable we are creating. Make sure to separate the domains with a comma.
Click Save in the upper right hand corner.
Once saved, we are going to edit our GA-Pageview tag or Universal Anayltics tag. Click on Tags in the left hand menu and select your GA-Pageview tag.
Once you have the tag open, click on Advanced Configuration
Next, click on More Settings and then Fields to Set.
In the field name enter in allowLinker and set the Value to “true” as shown above. This instructs Analytics to check for a linker parameter and sets the true value of a domain to pass or accept the cookie information.
Next we are going to add another field and the field name will be cookieDomain and its value will be “auto”. What this does is lets Analytics know to continue the session from the starting session cookie.
Next, on the same screen scroll down to Cross Domain Tracking. Here we will insert the variable we created under the Auto Link Domains.
Click Save and now you are ready to publish your tag. As a best practice we typically recommend testing each of your tags.