Google Analytics setting cookies on static content despite being on entirely separate domain

Posted by Donald Jenkins on Pro Webmasters See other posts from Pro Webmasters or by Donald Jenkins
Published on 2012-03-03T11:09:54Z Indexed on 2012/04/11 5:44 UTC
Read the original article Hit count: 486

I recently decided to comply with the YSlow recommendation that static content is hosted on a cookieless domain.

As I already use the root of my domain (donaldjenkins.com) to host my website—on which Google Analytics sets a few cookies—that meant I had to move the CNAME URL for the CDN serving the static files from cdn.donaldjenkins.com to an entirely separate, dedicated domain. I purchased cdn.dj (yes, it's a real Djibouti domain name), hosted the files on the root (which contains nothing else, other than a robots.txt file) and set a CNAME of e.cdn.dj for the CDN. This setup works, but I was rather surprised to find that YSlow was still flagging the static files for not being cookie-free: here's a screenshot:

Static files still not cookie-free

The cdn.djdomain was new, and was never used for anything other than hosting these static files. Running httpfox on the site shows the _utma and _utmz Google Analytics cookies are being set on the static files listed above—despite their being hosted on an entirely separate, dedicated domain.

Here's my Google Analytics code:

//Google Analytics tracking code
var _gaq=[['_setAccount','UA-5245947-5'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
// [END] Google Analytics tracking code

I'm not obsessing about this issue—I know it's not really affecting server performance—but I'd like to just understand what is causing it not to go away...

© Pro Webmasters or respective owner

Related posts about google-analytics

Related posts about cookie