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

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

My problem is that Google 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 a dot) so that it does not apply to my image-only subdomain.

I already set the "Cookie Domain" parameter in the macro, which is a constant with the value "domain.com", and although the container is correctly published, the cookie domain remains ".example.com"

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

+4
source share
1 answer

Use cookie domain "none"

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

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

+1
source

Source: https://habr.com/ru/post/1527464/


All Articles