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 “”
Following is the line you will need to add:

For example, it will look like this…

<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxx-x");

As a result, Google Analytics will throw the following results for each of these URLs.

  • –> /default.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
Constructor: /$A1$B1

Now, the results for the above examples will look like:

  • –>
  • –>

Related Articles:
Google Analytics – Linking Across Different Domains
Analytics Tracking and Reporting Online and Offline Campaigns
Overview of Implementing Google Analytics Tracking Codes

Tagged with →  

One Response to Tracking Subdomains in One Profile for Google Analytics

  1. Daniel Kowalsky says:

    thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *