Cross-domain tracking for Universal Analytics
If your website visitors go from one website domain to another in the same visit, such as www.example.com/shopping/handbags to www.cart-example.com/shopping/handbags, you will want to ensure that Google Analytics is setup to track those visitors across website domains. If you do not set this up, the visitor session will break when they go from one domain to another and your data will show two seperate visitors (one on www.example.com and one on www.cart-example.com). You can read more about cross domain tracking in the help center article.
If you are implementing the Universal Analytics (analytics.js) tag via Google Tag Manager, setting up cross-domain tracking is a fairly simple process. But before you begin, make sure you’ve set up the gaDomain and gaCrossDomains constant string variables mentioned earlier in this guide. They will make this process even easier.
For each step below, you will be editing your Universal Analytics Pageviews tag in Google Tag Manager.
Under “More Settings > Fields to Set”. Here you will add 2 fields:
Field Name of ‘allowLinker’ with a Value of ‘true’.
- Field Name of ‘cookieDomain’ with a Value of ‘auto’ (no quotes), but if you have already setup the gaDomain variable, then simply choose that from the variables list.
Under “More Settings > Cross Domain Tracking” you’ll want to set up each of your owned domains that you want to configure for cross-domain tracking. You’ll set this up as a comma separated list (e.g. a.com, b.com, c.com). If you’ve already set up the gaCrossDomains variable (highly recommended), simply select that from the variables list.
Save, preview, debug, then publish the tag changes.