I use Google analytics for site visitor monitoring like majority of webmasters today. It is free, reliable and quite good in many of the respects. However, there are couple particular cases where you can screw yourself and analyze its results incorrectly. Here we will discuss one particular problem that is not too common, but happens quite often: by default, Google analytics handles multi-domain website visitors incorrectly.
Google analytics is geared towards having separate accounts on each subdomain. This means following: A visitor coming from one subdomain to another one is counted as completely new visit. This inflates your traffic ranks (effectively doubles them or more). This might happen even in cases if there are no redirects between versions without www and with www. Additionally, pages with same uri on different domains are shown as one and the same page in analysis. This is not as bad, but undesired behavior, as it makes harder to track everything on your analytics accounts.
Note – there is no real traffic decrease, however the traffic is shown 2x higher before fixing problems with subdomains.
Sure, inflating your search traffic might seem handy when selling sites or bragging about daily visitor count. However, it will not help you in the long term.
How to solve it? I have used partial solution for quite a while, where you add custom filter to put subdomain information in uri. However, it did not solve the problem with visitor amount. Recently, I have found a full solution.
You have to add a custom filter first :
- Name: Subdomain_fullurl_hack
- Type: Custom filter – Advanced
- Field A -> Extract A: Hostname > (.*)
- Field B -> Extract B: Request URI > (.*)
- Output To -> Constructor: Request URI > /$A1$B1
Secondly, you need to modify tracker code to set domain to your domain. This is done by adding a line after your tracker is initialized (below var pageTracker = …. line) :
Btw, thank you folks at searchdigital for this guide!
If you want to check the results, I suggest comparing ones you get from google analytics with ones you get with log analyzers, like awstats.