Mobile app version of vmapp.org
Login or Join
Eichhorn148

: Can I make Google Analytics set its cookies on just a subdomain? (I.e. www.domain.com, not domain.com) I’m using Google Analytics on a site — let’s call it www.domain.com. My Google Analytics

@Eichhorn148

Posted in: #GoogleAnalytics

I’m using Google Analytics on a site — let’s call it domain.com.
My Google Analytics website profile is for domain.com, and my only report is set up for domain.com. Requests to domain.com redirect permanently to domain.com.
I’ve got the regular Analytics JavaScript on my index page for the domain. For some reason, it seems to be setting its cookies for domain.com instead of domain.com.
This is unfortunate, as I’ve got cdn.domain.com set up as a CDN using Amazon Cloudfront, so I’d rather not have useless cookies (Analytics seems to set four cookies) cluttering up those requests.

How can I make Analytics set cookies for domain.com instead of domain.com?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Eichhorn148

1 Comments

Sorted by latest first Latest Oldest Best

 

@Eichhorn148

As far as I can tell, the way to achieve this is to add the following line to your Analytics JavaScript, with the other _gaq.push calls:

_gaq.push(['_setDomainName', 'www.domain.com']);


(See code.google.com/apis/analytics/docs/tracking/gaTrackingSite.html#siteLinkingConsiderations)
That fixed the cookies for me.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme