Reputation: 944
I have a variable in GTM, called "Cookie - ShareASale - ID" of type 1st party cookie.
I need a trigger, when this cookie doesn't exist.
I don't see "exists/doesn't exist" or smth similar in the dropdown. How can I do it? Maybe with regex?
Thank you.
Upvotes: 0
Views: 3199
Reputation: 32760
If the cookie does not exist, the GTM cookie variable will return undefined
, so the most straightforward check would be "<cookie variable> equals undefined
" (GTM variables behave basically like their vanilla JS counterparts, if there is no value assigned they are undefined).
If that is too ugly for you, you can go to the advanced options in your cookie variable and in the "format value" section change the default value to a value of your choosing (might even be another variable), and then compare for that in your trigger.
Upvotes: 1