Internet Marketing & SEO

Correct Tracking of Sub Domains in Google Analytics

Using a Single GA (Analytics) Tracking Code to Track Multiple Domains

Many organizations use sob-domains to link related web resources under a single domain. Some examples include:

  •         A blog subdomain –
  •         An online store –

There are of course many other examples but for our example, I am going to focus on a scenario of a company website connected to an online store. In our example, these two resources are hosted in separate locations. The company website - - runs on a content management system and the online store – - on Magento a dedicated ecommerce platform.

That GA Tracking Code

At first, it would seem obvious to use a separate tracking code for each website, which will work but will not produce optimal results. Besides making reporting difficult, the multiple tracking code option also closes the door on a critical metric – the tracking of visits across domains. Think of how useful it could be to know when visitors click thru from the content website to the shop. For example, when responding to a Buy Now call-to-action that opens on a shopping page.

This makes the use of a single Google Analytics tracking code the best option.

Setting Up a Single Tracking Code across Multiple Domains

This method of tracking results in all visits to the domain and its sub-domain(s) to be recorded together. You can still view results separately, however, using views. One caveat is to ensure that the views you create do not inadvertently hide some data. The way to prevent this is to leave the default view usually called ‘All Web Site Data’ untouched and to make a copy of it to use as your master view.

Once you have created you master view you can apply filters and enable Site Search to it, leaving you with a permanent backup in the form of your All Web Site Data view.

Step 1: Create your Master View.

Navigate to Admin and look for View Settings, near the top right side of the Admin page. (Check to see if there are already additional views setup, by clicking on the View dropdown, which will show all existing views)

Click on View Settings and you will see a Copy View button on the top right of your screen. Click that and give your view a name – in this case Master or Master View. After you have clicked the Copy View button, the new view will be loaded and you can configure it. If you have a search box on your site make sure you set Site Search Tracking to on. (Be aware that you may still need to specify parameters for this)

Step 2: Referral Exclusion List

Adding your main domain to the view’s referral exclusion list prevents artificial inflation of reported sessions. Without this setting, a user who moves from to our shop on will trigger a new session in Analytics.

To keep your numbers real, add an exclusion for the domain

Navigate to Admin – Tracking Info (it is usually top left near to Property Settings).  Then select Referral Exclusion List. Then add an exclusion for your top domain, which in our case is

Step 3: Setup a View for our Main Website

In our case, the view we created in Step 1 will show the combined traffic of our two domains. To see individual traffic reports from each of these websites, we need two more views to separate out the results.

First, create a new copy of the Master View; call it Main Website or Content Site or anything that makes sense in your situation. You should now have at least three views.

Add a filter to your new view to screen out all traffic not from the main domain. Navigate to Admin – All Filters. Then add a filter to the Main Website view. The filter should be setup as a Predefined Filter and should specify:

  •         Include only
  •         Traffic to the hostname
  •         That contains
  •         Hostname =

Step 4: Setup a View for our Shop

Now create another copy of the Master View we created in Step 1; let’s call the view Shop. You should now have at least four views.

Add a filter to screen out all traffic not from our domain. Navigate to Admin – All Filters and add a filter to the Shop view. The filter should be a Predefined Filter and should specify:

  •         Include only
  •         Traffic to the hostname
  •         That contains
  •         Hostname = shop.

This should filter out all non-shop traffic for the Shop view.

That’s It

You should now be ready to start watching your stats.


Much of the planning of this article came from a really good post on the subject called Guide to Tracking Multiple Subdomains in Google Analytics – by Eric W. Mobley here:


Post a Comment