Mobile app version of vmapp.org
Login or Join
Voss4911412

: Google Analytics Subdomain Tracking for WordPress I'm looking for the best solution to track my website's traffic using Google Analytics. I have a website that (currently) has two subdomains. The

@Voss4911412

Posted in: #GoogleAnalytics #Subdomain #Tracking #Wordpress

I'm looking for the best solution to track my website's traffic using Google Analytics. I have a website that (currently) has two subdomains. The subdomains are about very different content, the TLD shows some basic information about me and also shows excerpts from the two underlying subdomains. I'd like to be able to see information for the whole site, but also be able to specify per subdomain.

Obviously I'd like to use the more recent Asynchronous Google Analytics script.

I couldn't find any decent and more importantly, recent solutions or implementations for this. Any tips or pointers would be appreciated.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Voss4911412

2 Comments

Sorted by latest first Latest Oldest Best

 

@Radia820

I use this to track subdomains. Put this code at the end of your template before the </body> tag.

<script type="text/javascript">
//Tracking code customizations only
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'your analytics acct #']);
_gaq.push(['_setDomainName', '.your_domain_here.com']);
_gaq.push(['_setAllowHash', false]);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();</script>


The you'll need to setup multiple filters in the analytics interface to see the data combined and separate.

EDIT to add filtering information :

Easy tutorial for setting up subdomain filters

10% popularity Vote Up Vote Down


 

@Candy875

I think this article describes what you want www.google.com/support/analytics/bin/answer.py?answer=55524. It does say it's for the old version of the script, but the same principles - using cross domain tracking, and filter to get the subdomain stats - should apply.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme