Search code examples
eventstriggersgoogle-tag-manager

How to chain google tag manager triggers


I can't find this information in official docs, so I try asking here.

Say I've got a tag called Test, and the following triggers:

Trigger_1
Trigger_2
Trigger_3
Trigger_4

Now say that Test should be triggered after one of the first three triggers is fired AND then Trigger 4 is fired. Something like (fictional code):

if((Trigger_1 || Trigger_2 || Trigger_3) && Trigger_4){
   run Test;
}

Is there a way? Standard triggers are evaluated like OR, while triggers groups are evaluated like AND. Instead, I would need tag manager to evaluate (1 or 2 or 3) and (4).

Please note that all the triggers are custom events sent with dataLayer.push after user interaction.


Solution

  • A few options. The classical option, of course, would be to use trigger groups. But they're bugged and Google neglected to fix them for many years. The bug is that one trigger group can only fire once per real pageload. Which makes no sense in the age where SPAs are so common. But if it works for you, that's good.

    Another solution is chaining tags instead of chaining triggers. Trigger A fires a tag that sets cookie A, then trigger B fires, has cookie A in its condition and then triggers the rule. This is just an example. There are many ways to make it work.

    It's really quite rare though to need to chain triggers. Proper implementations quite rarely need to do it. Usually the chaining complexity is being delegated to the front-end team through the dataLayer and it's the best practice. A TMS is not exactly the great place to store complex logic given how little coding skills the majority of analytics implementation specialists are expected to have.