简体   繁体   中英

Tag Manager - Adding trigger firing exception based on cookie value

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?

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 :

在此处输入图片说明

  • Select "on specific pages"
  • The variable is your cookie name
  • The condition is "Equal to"
  • The value is the cookie value

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, eg "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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM