In order to track subdomains within the same profile as the primary domain, you will need to add an extra line in every pages with the tracking code.
Assuming your primary domain is “.your-site.com”
Following is the line you will need to add:
For example, it will look like this…
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
As a result, Google Analytics will throw the following results for each of these URLs.
- www.your-site.com/default.html –> /default.html
- shop.your-site.com/info.html –> /info.html
If you want to distinguish between your subdomains, you’ll need to create an “Advanced Filter” for your profile.
Filter Type: Custom filter > Advanced
Field A: Hostname
Extract A: (.*)
Field B: Request URI
Extract B: (.*)
Output To: Request URI
Now, the results for the above examples will look like:
- www.your-site.com/default.html –> www.your-site.com/default.html
- shop.your-site.com/info.html –> shop.your-site.com/info.html
Increase Your Website Conversions
Get your FREE cheat sheet: "5 Steps to Building a Profitable Website Using Marketing Technology"