secureprivacy.ai

Secure Privacy Support Center

Search for any help questions or topics.

How to block cookies in complex GTM triggers

Learn how to set up conditional triggering in Google Tag Manager based on user consent. This step-by-step guide provides instructions on how to integrate with GTM
Avatar
Andrew Sidorkin
Updated 6 months ago

While using GTM you may encounter a situation where you want to check the user's consent before firing any trigger.

In such cases, you can follow the Guide below for conditional triggering. 


In GTM, a tag will fire if all the trigger conditions on a tag evaluate to true. So you must add a condition to the existing trigger by adding a user-defined variable. Trigger conditions must all evaluate to be true for the trigger to fire.


Here is an example of adding a consent condition to an existing trigger:

  1. Create a user-defined variable and name it "Check {{Plugin_name}} consent". In the field "Custom Javascript", enter the following snippet:



     function(){ return sp.checkConsent("{{Plugin_name}}"); } 



2. Replace the {{Plugin_name}} with the exact name of your Service (Plugin), as shown on your scan report. The Service names are case-sensitive.


3. Modify your custom event trigger configuration as shown below. The values of the cookie consent trigger condition to add are: true/false (Boolean)


4. Your setup is now complete.


Was this article helpful?
😞 😐 😃