jsakurai
Crownpeak Employee
Crownpeak Employee

Combine "And" and "Or" conditions using GTM

In our standard GTM implementation we recommend applying either a vendor or category level trigger as well as an "all" category or vendor trigger.  Applying these triggers to a tag uses an "or" condition so that whether a user accepts the banner message (all) or consents to an individual category or vendor the tag fires.  

There may be times when you also need to incorporate an "And" condition into your triggering mechanism.  This guide will walk you through how to do this on a notice using category level consent but the same idea can be applied to vendor level notices as well.  This guide also assumes that you have already taken a look at our standard GTM implementation guide. 

Step 1: Eliminate the "all categories consented trigger" 

We will accomplish this by deleting the "all" categories trigger completely and then changing our category level trigger as seen in the screenshot below

GTMcategory.png

 

By using "matches RegEx (ignore case)" we can use regex to combine the category value with "all".  This is done by adding "|all" following the category value.  This allows us to mimic the original "or" condition within 1 trigger. 

 

Step 2: Create a "trigger group" using your newly reworked category trigger.

As you can see in the below screenshot this example trigger group is using our "advertising consent received" regex trigger from above and an additional trigger used for PDF Downloads.  

GTMtriggergroup.PNG

 

The end result of this trigger works under the hood as follows:

  • Fires if advertising consented OR all categories accepted by clicking "Accept" on banner/barrier.

AND

  • Fires if a PDF is downloaded.

 

Labels (1)

Can't find what you are looking for?

Find Answers

Search our DG Forum to find answers to questions asked by other DG users.

Ask a Question

No luck? Ask a question. Our Product and Support teams are monitoring the Forum and typically respond within 48 hours.

Ask a Question