combine multiple google tag manager triggers

6k views Asked by At

I'm trying to achieve the following:

  • One GTM container for multiple websites/domains (within the same platform)
  • Only fire tags that are active for the current website (by checking configured analytics / criteo / adwords / other vendor account id in data layer)
  • Configure triggers like 'booking page reached' and 'booking created' once (by custom event and using data layer)

My problem is combining the condition 'active tag' (checking for account id) with a 'booking created' event without duplicating logic. Because every trigger is an OR condition, not an AND condition.

Currently, this results in creating exceptions that are very specific, and contain most of the triggers like 'Booking created', specific for a tag (Analytics / Criteo / Adwords). Resulting in having to still make very specific (duplicate) triggers, instead of re-using them. Main issue is exceptions have to match the event type of the trigger. And triggers cannot be combined nor extended.

My tags / triggers configuration looks like this now:

current GTM configuration with specific exceptions

My questions:

  • Is there a way to combine multiple triggers (AND instead of OR)
  • Can I create an exception for tag that is not depended on the same event as the original trigger?
  • Am I looking for a solution in the wrong direction? How do I prevent triggering a tag that is disabled (by dataLayer), without duplicating 'custom events' logic for every different tag / vendor.
2

There are 2 answers

1
Eike Pierstorff On BEST ANSWER

If your main problem is that "exceptions have to match the event type of the trigger", the common workaround is to use a trigger of the type "custom event", check "use regex" and enter ".*" (without the quotes), which matches all events, including the built-in pageview (gtm.js), DOM ready (gtm.dom) and Window loaded (gtm.load). Then add conditions as needed.

GTM trigger custom events

3
Omar Venturi On

There is a more powerful and easiest way to combine triggers in multiple AND and OR.

First of all: if you need to combine triggers with just OR condition, you can simply add a list of triggers when you are configuring a tag. I am no talking about exceptions, just triggers. You can click on the (+) symbol and every trigger you add is managed with OR condition.

But, if you need, for instance, to add two triggers in AND? There is a very simple way that does not imply the regex.

Is the trigger group feature. Here are the steps.

  1. Create all the triggers you need to compose (in this phase you don't need to combine them, just one trigger at a time)
  2. Then create a new trigger, but in this case, choose the last type in the list, that is "trigger group". Et voilĂ ... you can combine in the group any of the existing triggers and define if you wnat combine them with AND or OR!!!! :)

Finally, go to your tag and use the GROUP instead of the single trigger.

That's all