How to Track Multiple Sub Domain in Google Analytics

If you’re trying to track a website in Google Analytics with multiple subdomains then you have come to the right place for help. I tried tracking subdomains in 2012 and found Google’s documentation unhelpful, so I created this guide. Since then, it has received over 132,000 pageviews, and I have been told on many occasions that this is the best source of information about tracking multiple subdomains in Google Analytics. I also update this guide, so it’s up to date with the latest information.
Tracking multiple subdomains in Google Analytics is a little tricky and there are a few pitfalls to avoid. I’ll take you through the steps necessary to ensure that you are tracking subdomains and also that your data is being reported correctly.

Before We Begin

Just a few things to keep in mind.
  • The easiest thing to do would be to give each subdomain a unique tracking ID and track them all separately. If you choose to do it that way, you will lose some important data when users move from one domain to another in a single session.
  • Each Google Analytics Account can have 25 Views, something to keep in mind if you have a lot of subdomains.
  • The method covered in this guide does not alter historical data. So, if you  have been tracking subdomains for awhile and are just now implementing the method in this guide, you may want to create segments for each subdomain. See the FAQ for more info on segments.
  • I recommend creating an extra View that remains untouched. This View should have no filters applied to it so you can compare the data to it if you think something went amiss (really this is just good advice to anytime you are going to make some adjustments to analytics)
  • Check the real time analytics for instant feedback and to confirm you’re doing this correctly.
  • This is moderately difficult configuration if you are inexperienced with Google Analytics. I can set this up for you for a one time fee if you would like to save yourself some time . Please contact me for more info.

Installing Google Analytics for Multiple Subdomains

The first step in setting up Google Analytics to track multiple subdomains is to install the correct code. Thankfully, this part is usually pretty easy.
Make sure you are using the latest version of Google Analytics—called Universal Analytics. Input your domain into this Google Analytics checker tool and look for the column that says Universal Analytics and make sure it’s checked. If it’s not, I recommend upgrading to Universal Analytics because subdomain tracking is more effective in the latest version.
When you have confirmed that you are using Universal Analytics or upgraded, then copy & paste the default Google Analytics code into each subdomain. There’s no need to make any adjustments to the code for our purposes here.
Then, our next step is to add your domain to the referral exclusion list (Admin -> Tracking Info -> Referral Exclusion List). Make sure to just add the root domain without the subdomain or www. This will ensure that as users move between subdomains, the session will be preserved and will not create a new session every time the user navigates between subdomains.
Once you have the correct code installed on all subdomains and you have added your domain to the referral exclusion list, you’re already tracking subdomains. Keep reading, because we have a little bit more work to do to ensure we’re reporting data correctly.

Display Subdomains In Your Analytics Data

Now we will begin to work on displaying the data properly.
By default, Google Analytics does not show the domain or subdomain in lists of pages.
Google Analytics page list
Google Analytics page list
Notice that in the image above, it shows the path, but not the domain. This can be a problem when tracking multiple subdomains because you will not be able to tell the difference between subdomains when viewing a list of pages. If you have pages that have the same path on any two subdomains, you will not be able to tell the difference between them in the data. This includes the home page which will only display a forward slash.
We need to create a filter that will display the subdomains in our list of pages. We’ll end up with something like the image below. Compare it to the image above and note that it shows subdomains, including the www and blog subdomain.
Google Analytics page list with subdomains
Google Analytics page list with subdomains
Notethis filter will conflict with destination goals. You can still use this filter, but if you are using destination goals, you will need to make sure the destination is exactly the same as the page in the page list (Behavior -> Site Content -> All Pages)
There are two different ways to do this filter.
It is important to remember that filters in Google Analytics do not alter historical data. This will be important to consider when choosing which filter to enter. The filter that you should enter will depend on how you want to handle your historical data.
If you want to show the domain for all of your subdomains, follow the filter below. Use this filter if you just created your analytics account and started tracking your website.
Filter to show full domain for all domains and subdomains
If you want to only show the domain for a specific subdomain then do the exact same filter above, except for the Hostname field enter(subdomain.yoursite.com) instead of (.*). Use this filter if you have been using Google Analytics to track your website for awhile and just added new subdomains.

Set Up A View For Each Subdomain (Optional)

A View is what Google Analytics uses to refer to profiles of data. You can create unique Views that will allow you to manipulate the data in different ways for that View without effecting other Views.
To best organize your data I recommend creating a view for each subdomain in addition to the View that we already have that collects data on all of our subdomains. This is optional, you can skip this if you don’t think you will ever want to see your data divided between subdomains.
If you have been following along closely so far, we have already created a view that collects data on all of the subdomains collectively and configured Google Analytics to display our subdomain data. Now we need to create a view for each subdomain. Start by going to Admin -> Views -> Create New View.
Once you have created a new view, you need to apply filters to make sure each view is only collecting data on their assigned subdomain.
To apply a filter that ensures that we track only traffic for the view’s designated subdomain, go to Admin -> Views -> Filters -> New Filter and refer to the screenshot below.
Filter to only include traffic to the specified subdomain
Applying this filter to your profile will ensure that this profile only tracks traffic for the specified subdomain. In this case, www.yoursite.com. Remember, www is a subdomain itself. Repeat this filter for each profile that you created where you need to isolate a subdomain.

Frequently Asked Questions

“Is there a way to see historical data for my subdomains?”
There sure is. You can see the data for a particular subdomain by creating a segment. To create a segment for each subdomain, go to New Segment -> Advanced -> Conditions -> Hostname.
“Do I need to update my Google Analytics code?”
Maybe. I don’t know what your setup looks like. I can say that the default Universal Analytics code is all you need, for both your main domain and subdomains. No special configuration to the code necessary.
“Does my domain and subdomains need to use the same Google Analytics ID?”
Yes.
“Why don’t my goals work anymore?”
If you are using destination goals on a subdomain, you will need to update them. Above I note how to use destination goals when tracking subdomains.
“Why are my subdomains showing up as referrals?”
By default, Google Analytics creates a new session when users navigate from one subdomain to another. To fix this, go to to Tracking Info -> Referral Exclusion List and add your domains.
“Why are my conversions are showing my other domain as the source?”
Same issue as the question above, Google Analytics is creating a new session when users are moving from one subdomain to another.
“How come the numbers don’t match between views?”
Make sure that all of your views are the same time zone. Seriously. If they are in different time zones you will spend way too much time trying to figure out why the data appears incorrect. Like I did.
“Why does Google make this so bloody difficult?”
If I had a nickel for every time someone asked me that…
“Can you just set this up for me?”

No comments:

SEO News