Sub Domain Tracking with Google Analytics
There are 2 ways to track sub domains with Google Analytics, you can track all sub domains in a single profile or track sub domains in separate profiles.
Step 1: To track all sub domains in a single profile, add the following line of code (in bold) to the tracking code on all pages of sub domain and main domain:
<script>
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>
var pageTracker = _gat._getTracker(”UA-xxxxxx-x”);
pageTracker._setDomainName(”.maindomain.com”);
pageTracker._trackPageview();
</script>
This change will allow you to track sub domains within one profile.
Step 2: To track sub domain in separate profiles.
- Create new website profile.

New GA Profile Creation
- Add Filters

Applying Filter in GA
This way you can track each sub domain in a separate profile.
Tags: Analytics, Google Analytics, Google Analytics Sub Domain Tracking, Google Analytics Tracking, Sub Domain Tracking















Comments