Cookie Monster - Custom Tag Template
Use the Cookie Monster template to set any browser cookie(s) you like in the HTTP response back from the Server container.
Each cookie is added as a new row into the table field. The configurable values are:
- Name – the name of the cookie.
- Value - the value of the cookie.
- Expiration - expiration of the cookie (in seconds).
- Domain - on which domain to write the cookie.
You can hard-code the Value if you wish, or you can fetch the value from the HTTP request itself by creating a new Cookie Value variable. For example, to fetch the value of the
_fbc cookie in the HTTP request, you can use a variable like this:
If you only want to set the cookie if the HTTP request has a valid value, you should configure this in the tag trigger. The Cookie Monster tag will write the cookie whether it gets a valid value or not.
You can configure the expiration and domain as well. If you set Domain to
auto, it will attempt to write the cookie on the highest possible level in the domain name hierarchy. For example, if the GTM server is running on
sgtm.simoahava.com, setting Domain to
auto will have the tag write the cookie on
|10 May 2021||Added HttpOnly option.|
|26 April 2021||Initial release.|