Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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...

share|improve this question
    
I'm seeing a "Grade A on Use cookie-free domains" - it's only listing the TypeKit files as as being served from a domain with cookies - try deleting all your cookies from the site and trying again, see if any more are set? –  Zhaph - Ben Duguid Mar 9 '12 at 21:40
    
Yes, they disappeared eventually and never came back. Still a bit confused as to why they should have appeared in the first place. –  Donald Jenkins Mar 13 '12 at 8:33

2 Answers 2

What's the question? You can't have Analytics in the code, and not set cookies. Doesn't matter what domain you're using or have set in Analytics. For example, I can still track an old site that I don't own anymore because the Analytics is still triggered when someone visits the cached version on archive.org.

If you want to speed up Analytics, use the new asynchronous code, and put it before ending tag. Then use page speed that is built into the new Analytics.

share|improve this answer
    
Thanks! Actually, my setup eventually resulted in cookies disappearing. And I am using the asynchronous code! –  Donald Jenkins Mar 13 '12 at 8:32
    
Oh wow, that is strange. Whoops, I must be blind! –  SEO Mar 13 '12 at 19:46
    
yeah, the one recommended by html5boilerplate, to be precise, which was developed by Mathias Bynens: mathiasbynens.be/notes/async-analytics-snippet –  Donald Jenkins Mar 13 '12 at 23:14
    
Great reference. Have bookmarked for future use. Thanks. –  SEO Mar 14 '12 at 0:29

Google analytics has an option for setdomainname that will allow you to set the tracker to your non-cookieless domain.

this is best described here. Look at the second 0 voted answer.

http://stackoverflow.com/questions/3232868/disable-google-anayltics-cookie-from-being-sent-to-cookie-less-domain

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.