Cross Domain Tracking Is Easier Than You Think
Digital Marketing
In the online marketing game, analytics are everything. Measuring ruthlessly allows you to inform your decisions and make the best use of your advertising dollars to connect with your customers.
Google Analytics (GA) is the industry benchmark for gathering data about your website’s visitors.
But what happens when your company has more than one website?
Having a company website and an outside eCommerce site powered by an external host has become increasingly common and you’ll want to track the two websites with Google Analytics, as the data from both sites are valuable to you.
However, managing and measuring two separate GA accounts is redundant and taxing on your time and marketing budget.
Unifying Your Analytics Tracking
Cross domain tracking allows you to track two domains into one Google Analytics account. Sharing GA across two domains is, for the most part, rather easy. You simply need to add some extra code to your GA tracking code snippet.
You should have a basic knowledge of HTML and JavaScript or work with a developer to set up cross domain tracking.
First Steps: Identifying Needs and Requirements
Before you start making changes, answer these questions:
- Are you already using Google Analytics, and if so, are you using the Classic or Universal version?
- Do you have to track traffic going both ways ( www.site-a.com <-> www.site-b.com) or one way (www.site-a.com -> www.site-b.com) ?
- Are you using Google Tag Manager?
- Are you using the same container for both sites?
- Are there more than 2 sites involved?
There are two ways to implement Cross Domain Tracking when using the Tag Manager: Link/Form decorator tags and Auto Link Domains.
When using Classic Google Analytics you can only use the link and form decorator tags, but with Universal Google Analytics you can use either method.
Setting up Cross Domain Tracking by Modifying the Tracking Code
Step 1
On your origin site add the {‘allowLinker’: true} to your create tag, import the linker plugin, and add the auto linker to your destination site ga(‘create’, ‘UA-########-1’, ‘auto’, {‘allowLinker’: true}); ga(‘require’, ‘linker’); ga(‘linker:autoLink’, [‘website-b.com’]);
Step 2
On your destination site add the {‘allowLinker’: true} to your create tag and import the ‘linker’ plugin, and add the auto linker to your destination site ga(‘create’, ‘UA-########-1’, ‘auto’, {‘allowLinker’: true}); ga(‘require’, ‘linker’); ga(‘linker:autoLink’, [‘website-a.com’]);
OR
Simplify it and add everything to both ga(‘create’, ‘UA-########-1’, ‘auto’, {‘allowLinker’: true}); ga(‘require’, ‘linker’); ga(‘linker:autoLink’, [‘website-b.com’, ‘website-a.com’], false, true); //The extra parameters here allow you to cross domain track with forms as well
If you’re using Google Tag Manager Google support provides detailed instructions on how to set up your Tag properly.
Using Classic Analytics? Check out more information about tracking multiple domains here.
Checking out your data
Now that our data is coming in we need to make it mean something. Chances are high that some of your page names overlap between sites such as /thanks or /contact-us. This means that when you're looking at your reports you may not be able to tell which website to attribute that data to. You can create a filter for your data to show full website urls to solve this.
- In your testing view add a new filter
- The filter type will be Custom > Advanced
- Set the dropdown of Field A -> Extract A to Hostname and the content to "(.*)"
- Set the dropdown of Field B -> Extract B to Request URI and the content to "(.*)"
- Set the dropdown of Output To -> Constructor to Request URI and the content to "$A1$B1"
- Save the filter
Now you're all set to track user paths across multiple domains. Happy analyzing!