Subdomain and Cross-domain Tracking in Google Analytics

/, Google Analytics, Google Tag Manager/Subdomain and Cross-domain Tracking in Google Analytics

Subdomain and Cross-domain Tracking in Google Analytics

Universal Analytics allows tracking of two of more subdomains within a single property without any additional configuration. For example, if you have website.com, blog.website.com, and info.website.com and you would like to track them all within one Google Analytics account, under the same property, you can track all of these subdomains using the same Universal Analytics code as your main domain. This article is going to provide you with step-by-step instruction on how to implement this.

Tracking two or more subdomains within a single property

This is supported by the default tracking code in Universal Analytics; you can do this by placing the same Universal Analytics tracking code on all of your web pages under your main and subdomains. You can also implement the tracking code through Google Tag Manager. I highly recommend using Google Tag Manager, as it allows you to implement tracking of different activities on your website without involving your developers. Simply implement the Google Tag Manager code on your site and subdomain sites the same way you would to Google Analytics. See more detail on how to implement here: How to Setup Google Analytics Using Google Tag Manager 2.0 

Add hostname plus request URI

To distinguish between request URIs on the different domains, you need to apply an advanced filter to your working view(s) that prepends the hostname (subdomains or domains) to the request URI.

For example,

  1. /digital-analytics will become blog.siteber.com/digital-analytics
  2. /google-tracking will become siteber.com/google-tracking

This way, when you look at the reports in Google Analytics, you’d be able to distinguish between different subdomains and domain. Here are the steps to apply the advanced filter to add the hostname to the request URI.

  1. Go to Admin section of your Google Analytics account, under view, select filters.
  2. Create a New Filter using the following configuration:
  • Filter Name: Show Full Domain
  • Filter Type: Custom, Advanced
  • Field A-> Extract A: Hostname: (.*)
  • Field B-> Extract B: (.*)
  • Output to-> Constructor: Request URI: $A1$B1
  • Check Field A Required
  • Check Override Output Field
Related:  Top Free Websites for Digital Marketers to Master Excel Skills

Click Save

Subdomain and cross domain tracking

Filter by hostname

To easily view activity on a single domain or subdomain that you’re tracking with other domains or subdomains in a single property, you can create additional views that are filtered to include only hostname.

After you have added hostname plus request URI, you should be able to easily create different views for your different subdomains and your main domain.

To create different views, click on View, and create new view. Each property can have up to 25 views. Normally you’d want to have at least three different views for each property you are tracking.

  1. Unfiltered
  2. Test
  3. Master (Working)

Go through the process of creating new views, and then go to Filters again.

  1. Click on +New Filter, and pick Apply existing Filter, you should be able to see all the filters you have created (go to Add hostname plus request URI if you haven’t created a Full Domain filter already). Add the full domain filter and click save.
  2. Click on +New Filter, name your new filter (for example, Blog.siteber.com Traffic Only).
  3. Filter Type: Predefined
  4. Include only, traffic to the hostname, that begin with
  5. Hostname: blog.siteber.com

Subdomain and cross domain tracking2

You can verify your filter.

Click save.

Make sure the filter Show Full Domain is before the blog.siteber.com traffic only filter as it filters based on the full domain URL.

By following the steps above, you can create different views for each of your properties.

Let me know if you have any problem configuring subdomain tracking below in the comment section.

 

About the Author:

Cofounder of Siteber: a digital marketing professional with Master of Science in Marketing Analytics, specialize in SEO and Digital Analytics.

One Comment

  1. Nicolas Colombres July 3, 2015 at 4:41 pm - Reply

    Very Helpfull Article. Im starting my journey in Analytics and this was very helpfull to understand a little better!

    Thanks Jessie!

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.