Analytics _setDomainName not working anymore
cookies, google-analytics, subdomain
Solution
OK after much head banging I managed to solve this mystery. Turns out that the order of the `_gaq.push([]);`'s is relevant. If you have, besides the usual `_setAccount` and `_trackPageView`, any other GA calls (like `_setCustomVar`), that set cookies, you have to tell GA which domain to set cookies for first. Seems obvious in retrospect but to be fair, that's not really clear from the documentation.
Anyhow be sure to put the call to `_setDomainName`first, and then any other GA calls you might have.
Problem
This suddenly stopped working. We have Google Analytics on our page and a couple of months ago we tweaked the code so that GA's cookies would only be set for www.igre123.com and not it's subdomains (we do a redirect from igre123.com to www.igre123.com, so that users are always using www.). We did this because we have two subdomains that serve static content (css, js, thumbnails, etc) from (s.igre123.com and static.igre123com). To prevent cookies being set for the subdomains (and only for www.) we modified our GA code to look something like this: ``` ... _gaq.push(['_setDomainName','www.igre123.com']); _gaq.push(['_trackPageview']); ... ``` This did the trick but now it's not working anymore. Anybody have some idea why this stopped working? Unfortunately I don't know when exactly this stopped working :/ edit: tracking otherwise works without a problem.