Apr 222012
 
Article Analytics

(Read this post in spanish)

If a web site spans several subdomains (for instance, a main site ‘www.site.com’, a blog ‘blog.site.com’ and a forum ‘forum.site.com’), on one hand we may be interested in tracking each individual subdomain, but on the other hand we will be also interested in an aggregated view of the overall traffic of the domain.

This can be done in Google Analytics by defining several profiles and filters under the same account, as we explain below:

Taking our own domain ‘openalfa.com’ as example, our content resides in three subdomains:

      • www.openalfa.com
      • blog.openalfa.com
      • blog-en.openalfa.com

When we create our analytics account, it has a single profile defined. We change the name of this profile to ‘openalfa.com’ and retrieve the tracking code, specifying that we are going to track a domain with multiple subdomains:

Codigo de seguimiento de analytics para varios subdominios

If we compare this code with the one used to track a single domain, we can see that the only difference is an additional sentence:

This sentence states that the user session pertains to the domain ‘openalfa.com’, whether the pages accessed are from www.openalfa.com or from blog.openalfa.com.

Once the tracking code has been copied to all pages in all subdomains, we proceed to define an advanced filter in the main profile ‘openalfa.com’. The purpose of this filter is to add the subdomain as a prefix to all urls displayed inside Google Analytics (in this way, we will be able to distinguish, for instance, between ‘www.openalfa.com/index.php’ and ‘blog.openalfa.com/index.php’. Without this filter, both urls would appear in analytics as ‘/index.php’).

Finally, we define a new profile for each of the subdomains we want to track individually.

In each of these subdomain profiles, we create and advanced filter to include only traffic generated in the corresponding subdomain.

In the next screenshot we can see as an example the case of the filter create for the profile ‘www.openalfa.com’:

Definicion de filtro para perfil de subdominio en analytics

 

Next, we proceed in the same way creating profiles for the subdomains ‘blog.openalfa.com’ and ‘blog-en.openalfa.com’, and creating their advanced filters.

And that’s it !

 Posted by at 9:44 am

  One Response to “How to track a web site across multiple subdomains”

 Leave a Reply

(required)

(required)