I need help in setting up the exception in trigger firing based on specific cookies value.
It should look like that: If "my_custom_cookie_name" value is "0" then the tag isn't fired. Could you please help me with that? Where should I start? Which parameters should I pick to create such a condition?
So does Google Tag Manager use cookies? No, it does not. The only exception is Preview and Debug mode. Once you enable it, GTM sets several first-party cookies on your browser.
A data layer is a JavaScript object that is used to pass information from your website to your Tag Manager container. You can then use that information to populate variables and activate triggers in your tag configurations.
You have enabled preview mode of Google Tag Manager. If you still see Google Tag Manager firing twice, another reason might be GTM's preview mode. When Preview and debug mode is enabled, it sends two requests to Google Tag Manager: one to load gtm.
For example, if you want to add a condition on the trigger of a pageview :
1. You need to create a custom variable (cookie first party) :
The value is the name of your cookie
2. Then, you need to create your trigger with a specific condition :
You can read a first party cookie variable with the name of your cookie - just go to variables/new and select 1st-party-cookie as variable type and enter the name of the cookie. Name your variable as you like it, e.g. "myCookie".
Then create a trigger of the type custom event, enable regex matching and enter ".*" (without the quotes).
Click "this trigger fires on some custom events". In the dropdown that appears select your "myCookie" variable, set "equals" as match type and "0" (without quotes) as value.
Use this as exception trigger.
Setting this up as custom event is the easiest way, since this way will the trigger will work on pageload, domReady, click, submit and all other events, standards or custom. Else you would have to set up an exception for every possible GTM event.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With