Aresn
Aresn

Reputation: 163

stop sending google analytics cookie with ajax calls

I am using Google Analytics on an ajax heavy website. I have a timer on the website, making an XMLHttpRequest every few seconds. With every request, browser sends the Google Analytics cookies to my server. Since my server don't use these cookies, I want to somehow prevent the browser to include these cookies in every request.

including _gaq.push(['_setDomainName', 'none']); did not help!

any ideas ?

Upvotes: 0

Views: 438

Answers (2)

Aresn
Aresn

Reputation: 163

I ended up limiting analytic cookies to my domain, then created a sub-domain for the feed ajax call running on a timer, then used jsonp for cross site compatibility. Hope this helps someone else out there.

Upvotes: 0

Open SEO
Open SEO

Reputation: 1712

Google Analytics cookies are first party cookies.

They will be sent as every other first party cookie for each request to the same domain (and subdomains)

You need to use a different domain for your Ajax calls (but I guess it would bring some other troubles, but solutions exist : Cross Domain request )

Using a path like www.domain.com/ajax/ under which all ajax calls would happen, and create empty __utma, __utmb, __utmc and __utmz cookies with a cookie path of /ajax/ would fail. The empy cookies will not supersede the domain cookie for these requests , but will be added first in the request order

Upvotes: 1

Related Questions