Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Google Anayltics cookie from being sent to cookie less domain

To optimize my site i have set up a static subdomain for content such as images, css and javascript. How do i stop the google analytics tracking cookie from being sent to my static subdomain, but still to both example.com and www.example.com?

Have already looked through some of the documentation with no luck

like image 871
Olly Hicks Avatar asked Jul 12 '10 22:07

Olly Hicks


1 Answers

You can't have a cookie that gets sent to www.example.com and example.com but not othersubdomain.example.com.

You can in theory have a cookie that gets sent to example.com but not subdomain.example.com, but it doesn't work in IE.

This is why you should not use a no-www example.com address when you are planning on using subdomains with their own security context. It's best to have only one of www.example.com and example.com as the ‘proper’ URL anyway. So set up a redirect for example.com to go to www.example.com, and cookies won't be shared unless you deliberately set domain=.example.com on them.

like image 54
bobince Avatar answered Sep 27 '22 18:09

bobince