Google Analytics can be setup to track subdomains within the same profile as the main domain. In order to do so, you will need to add a line to the tracking code on each page of the subdomain.
1. Setup a profile for the main domain (ex: xyz.com).
2. Add the following line (in bold) to the tracking code on all pages of your subdomains and main domain:
<script type=”text/javascript”>
var gaJsHost = ((”https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(”%3Cscript src=’” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));
</script>
<script type=”text/javascript”>
var pageTracker = _gat._getTracker(”UA-XXXXXX-XX”);
pageTracker._setDomainName(”xyz.com”);
pageTracker._trackPageview();
</script>
3. In order to distinguish between your subdomains, create an Advanced filter for your profile with the following settings:
Filter Type: Custom filter > Advanced
Field A: Hostname
Extract A: (.*)
Field B: Request URI
Extract B: (.*)
Output To: Request URI
Constructor: /$A1$B1

{ 1 trackback }