How to Setup Cross Domain Tracking for Multiple Hostname Extensions

Let's start

Recently I came across a website having a single domain with multiple extensions. By extensions, I mean the hostname was single. For example, for a website, the extensions were,, and etc.

The website was same but it has multiple clones for different locations and languages. The objective was to track all these extensions within a single analytics account.

If you have this kind of website, you will have to setup cross domain tracking. This was an woocommerce website and we have to setup enhanced ecommerce tracking via GTM

For this kind of website, you will have a single GTM container and single GA property. Add your GTM tracking code to the main domain that is

Setting up cross domain tracking is quite easy in GTM. let’s go through a step by step guide to help you understand easily.

Step1: Setup GTM & GA

As mentioned above, you will have to setup GTM tracking code on the main website. You will then connect GA with GTM using the pageview tag.

Add all the GA tags that you want to use for sending ecommerce of event data to analytics. Make sure the data is appearing in Google Analytics.

Step2: Setup Cross Domain Tracking

To setup cross domain tracking, you will have to configure all the GA tags. For example, to track pageviews on all extensions, open the GA pageview tag.

Click on more settings

Click on fields to set

Add the two fields as shown in the image below

Do the same thing for all other GA tags you have setup. Preview changes and open each domain extension to verify the tags are firing and data is visible in analytics.

If everything is ok, save and publish changes.

Step3: Add All Extensions to Referral Exclusion List

If you don’t add all the extensions to your referral exclusion list, you will see these extensions listed in referral report. It is important that you always add your domain name plus any third party extension that you are using for transactions i.e to the referral exclusion list.

Step4: Create Separate View for Each Extension

Now, if you want to view data for each extension separately, you will have to create a new view and create a hostname filter. This will make sure that the view will only record data from the specific extension and not from all.

So, this was a very simple way to track data from multiple extensions and I hope this helped you. If you have any questions related to this topic, please let us know on Twitter.

Don't miss out when new resources launch

Our customer analytics experts share wisdom only once a month

Share now
We are customer-analytics consultancy that transforms messy data into actionable insights that will help you grow your company and make better data-backed decisions.