Last updated on January 13, 2016

Tracking multiple subdomains in Google Analytics is a little tricky since there is no “easy” button to push. You will need to configure analytics properly to track and display data correctly.

In this guide you will learn how to install Google Analytics to properly track subdomains and configure Google Analytics to best display the subdomain data. This guide helps you configure Google Analytics to view all of your subdomain data in one place.

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. This guide assumes that you want to roll each subdomain into a single account and track them together.
  • 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)
  • Always check the real time analytics to confirm you’re doing this correctly.
  • This is advanced configuration for 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.

Install Google Analytics for Multiple Subdomains

The first step in setting up Google Analytics to track multiple subdomains is to install the correct code.

If you are using Universal Analytics then your code is already correct. If you are setting up analytics for the first time then Google will give you the correct code.

If you are not using Universal Analytics; then simply go to Admin -> Property -> Tracking Info and make sure ‘Subdomains of [yoursite]’ is set to On. This will add the following code: _gaq.push([‘_setDomainName’, ‘’]);

You can also manually add the code to your analytics code if you are comfortable doing so.

Note: the code is the same for all of your subdomains. There is no need to adjust it for each subdomain.

Once you install this code on all of your subdomains Google Analytics will begin reporting data from each one. You have more work to do to best display and view this data. Keep reading.

Display Subdomains In Your Analytics Data

In the previous section you set Google Analytics up to track multiple subdomains; this section we will work on displaying the data properly.

By default Google Analytics does not show the domain or subdomain in your data. This poses a problem when tracking multiple subdomains because you will not be able to tell the difference between subdomains in the data.

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.

For example, if you have two pages like this: and they will both appear as /contact-us in your data.

We need to create a filter that will display the subdomain in our data.

Note: this filter will conflict with destination goals. 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 full path for all of your subdomains moving forward (including www or whatever your “main” domain is) follow the filter below.

Filter to show full domain (including subdomain)

If you want to only show the full path for a specific subdomain (this option may be more friendly with your historical data) then do the exact same filter above EXCEPT for the Hostname field enter ( with the parenthesis.

After applying one of these filters you will be able to differentiate traffic between subdomains.

Set Up Views For Each Subdomain (Optional, recommended)

Quick note on views. 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 and then another view that collectively allows you to display the data for all of the 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, 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?”


“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?”

Contact me for more info. I have set up this guide to be as up to date and informative as possible, but I’m willing to help you set this up for a one time fee.