Tracking / Excluding Subdomains in Google Analytics Views

Tracking Subdomains in Google Analytics

Tracking Subdomains with Google Analytics is not as complicated as it may seem. But it’s important to get the settings right to make sure that you are tracking Sessions and Users the proper way. Read more here to find out how to track or exclude Subdomains in Google Analytics Views the smart way!

As all of my clients know, I am not a huge fan of Subdomains. From a simple SEO perspective traffic that arrives at something.domain.tld isn’t the same traffic that arrives on www.domain.tld. In my experience, it is better to choose a subfolder structure like www.domain.tld/something/ instead of working with Subdomains. In any case, there might be reasons why you have to use subdomains, may it be for downloads, speed reasons, cloud services, secure client access… whatever it is. What I would like to explain to you here is how to track and the traffic that arrives on a Subdomain the right way.

Requirements to track Subdomains with Google Analytics

First of all, you will need to set up cross domain tracking in Google Analytics or Google Tag Manager. (Use the links to find a tutorial on that on my site). But why will you need cross-domain tracking? Well, Google Analytics is set to track only the traffic arriving at one domain where the Analytics tag is included. You could say “let’s include the Analytics tag on more than just one domain” and you are almost right. This is part one of the deal. The problem that you’d have is that a user who arrives at something.domain.tld and moves forward to www.domain.tld would trigger two different sessions. But this is not what you will want to see in your cross-domain tracking setup. You’d like to see only one session for this user, right? So here is how to do it: Cross Domain Tracking in Google Analytics or Cross Domain Tracking in Google Tag Manager. The way to accomplish this task is not to work with referral exclusion lists but to work with filters in your Google Analytics account. Besides the available standard filters, you are able to set individual filters that will help you to track only the traffic that arrives at a Subdomain. Here is how to do it:

Visit your Admin page for your Google Analytics Property

You will find a gear-wheel symbol in the lower left corner in your Google Analytics Account which leads to the admin page. Klick on it. You will now be forwarded to the Setup view of your Analytics account. The part we are now taking a closer look at is the outer right settings column, which is responsible for all view related settings (marked red in the following screenshot). Please find the “Filter” subsection and click on it.

Setting a Filter to only track Subdomains

subdomain-filter-in-google-analytics-setup-step-1 After you clicked on filters you will be forwarded to a different part of the settings page where you are able to add filters. Click on the button which says “+ Add Filter”. Now you can give your filter a custom name, activate the include radio button and more options will show up. Set the filter “Field” to Request URl and the filter “Pattern” to something\.domain\.tld You are set and can confirm the setting by scrolling down and click on save. After the page reloaded, the filter according to the name you assigned to it should now appear in the list. The settings should now look like this: Setup an Analytics View to exclude Subdomain traffic Filter Settings in Google Analytics to track only Subdomains First, you need to visit your Analytics Settings Page (see above for details). From there you should also go to the Filters sub settings below the view settings column. From there the steps to exclude the subdomain from one view are as follows:
  1. Set filter type to Custom Filter
  2. Activate the radio button named Exclude
  3. Set filter field to Request URL
  4. Set filter pattern to something\.domain\.tld
  5. Click on Save after scrolling to the bottom of the page
… and you are set.

One thing to keep in mind

If you set both filters for one view no traffic will be tracked for this view, except there are other subdomains that you have for your domain. Please make sure to use one view for each filter that you set up during this tutorial.

I have 10+ years experience in Online Marketing and I am the author of analysith.com. I am an entrepreneur, writing books and interesting articles in several magazines. I work as a Digital Analytics and Big Data Expert and SEO Specialist for several companies. You can read more about me here.

Leave a Reply

Your email address will not be published. Required fields are marked *

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