Own a website? Then you would be definitely using Google Analytics to see your site’s traffic statistics. Everybody knows how to add Google Analytics script to their website so Google can start tracking their website. All you need is a Google Account and a website.

But today I’m going to detail on how to view detailed statistics for subdomains in Google Analytics. In this tutorial you will learn the following :

  • Install Google Analytics for each subdomain
  • Set up profiles for each subdomain
  • Display subdomains in the main profile

Install Google Analytics for each subdomain

Visit the Google Analytics URL and sign-in. If you have already created a property for your site, you can see the status of your site as in the below image.

Google_Analytics_tracking_subdomain

As I already created some profiles, you can see some additional profiles in the drilldown of Google Analytics Id. Click on the main profile link. On the top navigation interface, click on the Admin tab. Below click on the Tracking Code tab.

Google_Analytics_Admin_tracking_code

Here you will find the tracking code snippet you need to paste in your subdomain. Under Standard tab you will find the following. You need to click the option “One domain with multiple subdomains” to get the Google Analytics code for your subdomain.

Google_Analytics_multiple_subdomains_tracking

As you can see in the red rectangle, that line of code differentiates from the main domain. You can paste the same code on multiple subdomains.

Set up profiles for each subdomain

One thing you need to understand is that “profile is different from property”. I first took the wrong step by creating a new property instead of a new profile. So if you create a new property, you are doing the mistake of creating a new Google Analytics Id again. To create a new profile, click on the Profiles tab next to Tracking Code tab under Admin tab.

Profiles_tab_Google_Analytics

Create a “New Profile”. Its always better to create a separate profile for each subdomain, so that you can track each subdomain separately. You also need to create a collective profile which will track all the subdomains. This collective profile can be your main profile.

Once you have created each profile, it’s time to apply the filters.

We need to apply a filter to ensure that we track only traffic for the profile’s designated subdomain. Click on the “Profile” you just created and click on the Filters tab.

Filters_subdomain_profile

Create a “New Filter” with the following settings.

Google Analytics Tracking Subdomain using Filter

[Source: ericmobley.net]

It’s that easy. Applying this filter to your profile will ensure that this profile only tracks traffic for the specified subdomain. In this case, mobile.yoursite.com.

Display Subdomains in the Main Profile

When tracking multiple subdomains under one profile you will not be able to differentiate between subdomains and the main domain. For example, if you navigate through Content -> Site Content -> Pages under Standard Reporting tab on the top, you will see there is no subdomain or domain before the URL of the page.

In order to see the hostname or subdomain or domain name before the page URL, you need to apply a filter to the main profile. The following are the settings for the filter.

display_subdomains_before_page_url_filter

After applying the above filter, you should see the subdomain name before your URL in the page list and you will be able to differentiate traffic between multiple subdomains and main domain. The page statistics will be as in the below screenshot.

display_multiple_subdomains_in_default_profile

This is how you can track multiple subdomains in Google Analytics. The steps should be easy to follow. Any doubts and questions, please let me know in the comments section. Please share this article if you find it useful!