4 Steps to Track Multiple Subdomains in Google Analytics

Google Analytics is extremely powerful and we all know how helpful it can be to monitor your readers to attain the results you want with your blog. Recently we setup couple of sub domains for BloggingeHow; namely Blogger Widgets and our eBook squeeze page. In this very guide, we'll dig into few simple steps that can let us setup our blog's sub domains in Google Analytics comprehensively.

how to setup sub domain in Anaytics

There are few steps that need to be followed when your Google Analytics account will start getting stats for your sub domains. There can be various strategies to achieve this. You can either create new Google Analytics account for each of your sub domain as you might already do for your root (main blog domain). e.g www.yourblog.com

Though this is very tiring and there is a way out to this. We can setup our same Analytics account that we use for the main blog domain to show us with the stats of our sub domains. This would help us better monitor all the stats in one place.

Once you're done with the post, you'll achieve:

  • Installing code of Google Analytics for each sub domain
  • Setting up profiles for every sub domain
  • Using main Profile of your blog to display sub domains data.

Step #1 Installing the Analytics Code for Each Sub domain

Go to your Sub domain Edit HTML section where you can edit its HTML. Place the following JavaScript that is a bit modified to track your sub domains data.

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-21525719-5']);
  _gaq.push(['_setDomainName', 'bloggingehow.com']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);


While studying your normal Google Anaytics code, you would notice that it doesntt have that extra line highlighted in red.

_gaq.push(['_setDomainName', 'bloggingehow.com']);

This is just the little modification we do that would help us track sub domains too. Notice how i have mentioned bloggingehow.com as a domain name.

You would have to put your main blog/website domain name here. e.g

_gaq.push(['_setDomainName', 'your-blog-domain-name-here.com']);

Simply replace  your-blog-domain-name-here.com with your domain here and place this entire code in above the </head> section of your sub domain HTML.

Repeat this for all the sub domains you want to track. Also, place the same modified version of the code in your main blog domain's HTML too.

Step #2 Setting up Profiles/Views for Sub domains

Here, you have to create new 'Views' also known at profiles in the previous version of Analytics (before the recent update).

Each 'View' would represent a sub domain of your blog so that you  can view stats for individual profiles/views.

To create new views, go to your Google Analytics Dashboard >>  Admin >> Create new view (in the drop down for views section). Consult the image below.

views in anaylics

You'll be shown a new screen where you can enter your new 'views' name. Select Website (and not mobile app, if you're following these steps for your blog/website's sub domain).

Once done your new view would be created.

Step #3 Adding Filters to Views/Profiles

Now choose your main domain view/profile (as shown in the picture below) and hit Filters. That would let you create new filters for your new domain. In this step, we'll only allow traffic from your specific view/profile that you just created so that we can track traffic from that very sub domain.

You would have to follow the image below to setup filters for your every single domain. Also, notice that www is its self a domain . So choose your profile/views that you previously created in step#2 for every single sub domain (also for www profile).

creating filters for subdomains in analytics

Once done, your filters would make sure that your profiles/views only show traffic for that particular sub domain.

Now its all done, though you would like to get your all profiles/views data in your main profile so that you would know how much traffic your blog gets combined with all the sub domains.

Follow the next step to achieve that.

Step#4 Adding Sub-domains Data to Main Blog Profile/View

 As per the previous settings, Analytics would display your sub domains links in a way that is not helpful to you. Notice in the image below how you would not be able to differentiate between your sub domains data.

So for this, you have to add a filter to your main profile as shown in the image below. This very filter would display the URL in a format that would display sub domain followed by main domain and they post extension.

Adding filter for your main profile/view as shown in the image below and you're all set.

Once done with the steps above, you'll start viewing data from your sub domains in your Analytics account. Best of luck



AdSense affiliate marketing Announcement AskHassam Blogger Blogging Tips Blogosphere News Bluehost Building Traffic BuySellAds Contest Customizations Disqus Tutorials Domain Hosting Drop Down Menus eBook Email Marketing Facebook Tutorials Feedburner Freelancing Giveaway Google Google Analytics Google Gmail Google Plus Tricks Guest Post HowTo Interview Making Money Online Monetization Motivation PayPal Pinterest Plugins review SEO Slideshare Social Media Top Lists Twitter Wordpress YouTube
BloggingeHow | Making Blogging Simpler: 4 Steps to Track Multiple Subdomains in Google Analytics
4 Steps to Track Multiple Subdomains in Google Analytics
BloggingeHow | Making Blogging Simpler
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy