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

New GA Profile Creation

  • Add Filters

    Applying Filter in GA

    Applying Filter in GA

This way you can track each sub domain in a separate profile.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Post to Twitter Tweet This Post

 

Tags: , , , ,

Comments

No comments so far.
  • Leave a Reply

     
    Your gravatar
    Your Name
     
     
     
     
     
 

Seattle, WA USA

The Plazas
10800 NE 8th St. Suite 802,
Seattle, WA 98004
+1 425 502 6542

Mumbai, India

1B Goldline Business Center
New Link Road Chincholi Bunder,
Malad (W) Mumbai 400064. India
+91 9820787679

Singapore

23/F Chevron House
30 Raffles Place
Singapore 048622
+65 64089704