SEARCH MARKETING BLOG

Tracking Google Analytics Traffic on the Subdomain

So we’ve all migrated our blogger blogs to the subdomain now haven’t we? Have we all remembered to sort out our tracking code though?It’s vitally important, in order to track the success of your SEO campaign, to ensure that you are tracking your traffic correctly.

The traditional snippet that Google Analytics provides, when you are creating an account, won’t actually work for tracking the subdomain traffic.

You are going to need to make a couple of modification – one modification to the tracking script and one modification to your Google Analytics.

1.) Modification to tracking script:

You need to add the following line (this is the script for the traditional code rather than the Asynchronous version)

pageTracker._setDomainName(“.example-domain.com”);

You add this line in the section that says:

var pageTracker = _gat._getTracker(“UA-xxxxxxx-x”);

pageTracker._setDomainName(“.example-domain.com”);

pageTracker._trackPageview();

2.) Modification to the Google Analytics account:

The first change allows Google to record the subdomain visits, but they still wont be showing up in Google Analytics properly so in order to distinguish which page is from which domain, we need to add a filter.

Click in to the Profile Settings ( Analytics Settings > Profile Settings ) and click to Add Filter.

Then on the “Create New Filter” screen you need to set it up to look like this:

And don’t forget that Google Analytics doesn’t update in realtime – so wait 24 hours until you start seeing traffic being recorded. For more info see Google’s advice

(p.s. Thanks to Lakhya for working this one out for me)

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>