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.
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.
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.
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.
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.
Create a âNew Filterâ with the following settings.
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.
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.
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!