Title: When user changes his cookie policy levels, how can I remove GTM cookies?
Tags: google-tag-manager
Question: We have a site, where user can change cookie policy level. At maximum level (4), we include GTM tag, which in turn creates a cookie _ga and _gat_UA_XXXXXX. If user changes his settings to a lower level, we hide the script, thus stopping him from being tracked. But the cookies remain. Can I be sure that cookie names "_ga" and "_gat_UA_XXXXXX" will always have same cookie names? I guess I'm asking if cookie name "_gat_UA_XXXXXX" is set per GTM key, for all clients ?

Here is the accepted answer: GTM does not set any cookies. These are Google Analytics cookies.
You cannot be sure that the cookie that holds the client id is always called "_ga" since it is possible to change the cookie name. However of the GA instance is under your control presumably you are the one who does the changing and so you will know how the cookie is called.
You can however be reasonably sure that, unless there is a major change in the GA version, the default cookie name will be "_ga".


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2016:00:07/15/16', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<google-tag-manager>', 'Title': 'When user changes his cookie policy levels, how can I remove GTM cookies?', 'ViewCount': 575, 'id': 38389103, 'user_AboutMe': '', 'user_AccountId': 2149055.0, 'user_DisplayName': 'Evaldas Raisutis', 'user_Reputation': 1578.0, 'user_Views': 277.0, 'user_id': 1905962.0}}