One of my friend asked about tracking sub domains with Google Analytics, It is a common question – many sites use sub domains, “What if you want to track a group of sub-domains in one profile and a second group of sub-domains in another profile? Or if you want to create new profiles for different groups of sub-domains to future? “
- Create a profile for the Primary Domain
The first step is to create a master profile. All web profiles, including profiles of various sectors on the basis of this profile. When you type a domain site uses the primary domain name website. In the following, I’m using www.mywebsite.com the domain name of the site.
After creating the profile shows the tracking code Google Analytics for the site. Before adding to your pages should be changed. It is necessary to force Georgia to use the main site for the cookie domain. This change will allow you to track every visitor unique in all domains under. In turn, we will collect all data on the site in one profile and and do ‘roll up’ reporting.
Old urchin.js tracking code:
<script type="text/javascript"> _uacct = "UA-XXXXXXX-1"; _udn = "sitedomain.com"; urchinTracker(); </script>
New ga.js tracking code:
<script type="text/javascript"> var pageTracker = _gat._getTracker("UA-XXXXXX-1"); pageTracker._setDomainName("sitedomain.com"); pageTracker._initData(); pageTracker._trackPageview(); </script>
Note: Use the new tracking code if possible, since it allows monitoring the site search and Rich Media Monitoring and exit links.
- Create profiles for SubDomains
Once you create the master profile, you can begin to create profiles for each of the subdomains. Remember, each sub-domain profile is based on the master profile that you created in step 1. Here’s how to configure the new profile
Now that you’ve created the profile, be sure to add a tracking code on pages in the subdomain. Tracking sub domains with Google Analytics is the same as the tracking code that goes on the primary domain (the code in step 1).
- Add Filters to Sub Domain Profiles
The next step is to add a filter to the sub domain profile so it only contains data for the appropriate sub domain. This is done using an include filter based on the hostname. Once this filter is in place you’ll have the master profile which will contain data for all sub domains, and this profile that will contain data for a specific sub domain.
To create additional profiles for other areas just repeat steps 2 and 3. Obviously, the filter settings used in step 3 depends on the subdomain you want to include in the profile.
- Creating Additional Profiles
Let’s say you need to create a profile for two sub domains: 1.website.com and 2.website.com. This can easily be done because the same tracking code is on both sites. All you need to do is add an include filter with the following settings:
Although the documentation Google describes a good way to track the sub-domains, I think this approach is better because of its flexibility. Moreover, because the tracking code uses the same all sub-domains that do not have to worry about placing the wrong tracking code on a subdomain.
Incoming search terms:
- google analytics sub-domain profile
- googles tracking domains
- track subdomain

Your Post very informative for me and others. Keep it up.
Thanks for sharing sub domain Analytics information. It’s too good.
Got it! Thnkas a lot again for helping me out!
Hi Krunal Soni,
Just for the argument sake- if you have like 1,2,3 …. and so on till 500 microsites for the parent domain? what will be the strategy?
T&R,
Nishanth T
For Effective Micro-site, I must re-command you “Create an Effective Microsite“