Can I make Google Analytics set its cookies on just a subdomain? (I.e. www.domain.com, not domain.com)

Posted by Paul D. Waite on Pro Webmasters See other posts from Pro Webmasters or by Paul D. Waite
Published on 2010-12-01T01:24:59Z Indexed on 2012/11/26 23:25 UTC
Read the original article Hit count: 216

Filed under:

I’m using Google Analytics on a site — let’s call it www.domain.com.

My Google Analytics website profile is for www.domain.com, and my only report is set up for www.domain.com. Requests to domain.com redirect permanently to www.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 www.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 www.domain.com instead of domain.com?

© Pro Webmasters or respective owner

Related posts about google-analytics