Google analytics and multiple independent subdomains
Posted
by
MTilsted
on Server Fault
See other posts from Server Fault
or by MTilsted
Published on 2011-01-15T01:44:03Z
Indexed on
2011/01/15
1:54 UTC
Read the original article
Hit count: 244
google-analytics
|subdomains
I need some help trying to setup google analytics correct. Here is my setup:
We host sites for multiple customers, and each customer have their own subdomain on our site. So we have customerA.oursite.com and customerB.oursite.com
As we add more customers we get more subdomains. We do want to track all data for each customer independent, but I don't want to to create a new google tracking code for each new customer.
So my plan is to track all visits with "oursite.com", and then I will create a filter in google Analytics to get data for each specific customer(All visits for a specific subdomain). Is this(One tracking code, and a subdomain filter) the right way to do it?
To create a subdomain filter i add a new profile for each customer, and then add a custom filter saying include "Request URI" and fill in "CustomerDomain.oursite.com". Is this the correct way to do it?
And a general question about filters: Is it really impossible to create a new filter by applying it to data in an existing profile? I would really like to just collect all the data in one "main" profile and then create subdomain filters as we need them. But it seems that google only apply filters to new incomming data, not existing data. Is this really true?
The following is my tracking code. Is '_setDomainName','none' the right thing to do?
<script type="text/javascript">
/* Tracking code for qrtown.com */
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-11584298-10']);
_gaq.push(['_setDomainName', 'none']);
_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>
© Server Fault or respective owner