user3322665
user3322665

Reputation: 41

Modifying cookie domain in Google Tag Manager from ".example.com" to "example.com"

on my website I have Google Tag Manager with a GA Universal Analytics Tag installed. All images on the site are on a dedicated subdomain: images.example.com

My issue is that Analytics sets its _ga cookie to ".example.com" so it is sent along with all requests to images.example.com. I would like to set the cookie domain to "example.com" (without the dot) so it does not apply to my image-only subdomain.

I have already set the "Cookie Domain" setting to a macro which is a constant with the value "domain.com" and even though the container is properly published the cookie domain remains ".example.com"

Do you guys have any hints on how I could change the cookie domain?

Upvotes: 4

Views: 2777

Answers (1)

David Pattison
David Pattison

Reputation: 269

Use the cookie domain "none"

This will set a host-only cookie which will not be sent for all subdomains. Except in IE.

See the localhost example here: https://developers.google.com/analytics/devguides/collection/analyticsjs/domains

Upvotes: 1

Related Questions