views:

1076

answers:

3

Hello

I have a website on www.example.com and use Google Analytics. I've also set up static.example.com which serves all static content.

The problem is that the default behavior of GA is to issue cookies on ".example.com" but I don't want the static content traffic to be carrying the weight the GA cookies.

I tried pageTracker._setDomainName("none"); and it worked well for the cookies problem but it completely messed up the "Avg. Time on Site" report (from 5 mins average it went to 40 mins until the day I reverted the _setDomainName call).

Any idea why this is happening and how could I fix it?

Thanks

+1  A: 

Google Analytics stores all session data in cookies that helps it to ‘remember’ previous page views. The function call pageTracker._setDomainName(".example.com") tells every sites to store cookies for host example.com (instead of their own subdomain) to ensure the ability to reach each other's data.

The form pageTracker._setDomainName("none") is needed in and only in that case when your site spans across multiple, different domain names.

Set this method to none in the following two situations:

* You want to disable tracking across sub-domains.
* You want to set up tracking across two separate domain names.

Cross-domain tracking requires configuration of the _setAllowLinker() and _link methods.

To answer your question, Google Analytics uses first-party based cookies for collecting data. When you want your static content's traffic to appear in GA, you have to allow cookies for them, too. To avoid this issue, you may choose a server solution like Urchin that parses server log files instead of dealing with cookies.

Török Gábor
Thanks for your answer. I'm trying to explicitly do pageTracker._setDomainName("www.example.com") and will let you know of the results soon.
cherouvim
As an aside, my understanding is another case where pageTracker._setDomainName("none") is warranted is when you have a single name site as with an intranet, e.g. http://intranet
Mike Knowles
+3  A: 

The solution is to do pageTracker._setDomainName("www.example.com") and then GA will issue the cookies to ".www.example.com". That way analytics still works fine and the cookies do not leak into the other static subdomain.

cherouvim
A: 

What is the exact process to make google analytics code to count each visit from my browser.

when i visit my website 100 times a day from same IP, same computer, same browser then everyone knows that google will not count and display 100 visits in google analytics report, Now what i want to see is all 100 visits count to appear in GA reports.Got my point?

Hoping needfull solution for experts.

matrimony
You can ask a question for that.
cherouvim