Finesse
Finesse

Reputation: 10821

How to launch a tag when all the triggers have fired in Google Tag Manager?

You can attach two or more triggers to a tag. They are united with the OR rule, i.e. the tag starts when one of the triggers fires. How to unite the triggers with the AND rule, i.e. make a tag which starts when ALL the given triggers have fired?

Use case: I have a tag that must start when the page DOM is ready and the user location is determined (the location determination starts as soon as possible, before the DOM is ready). I made 2 triggers: «DOM ready» (built-in event) and «Location determined» (custom event fired by a JavaScript code).

P.S. Starting the location determination after the DOM is ready is a workaround, not an answer.

Upvotes: 1

Views: 603

Answers (1)

Eike Pierstorff
Eike Pierstorff

Reputation: 32780

There is no "and" condition for triggers (and to combine two event based triggers would be impossible, since you cannot evaluate two events at the same time).

The easiest way would be to push a variable to the dataLayer on the "Location determined" event and then have a DOM Ready trigger that fires only when the variable is set (actually you don't event need an event on location determined - if you just push a value it will be accessible on the next event sent to the datalayer, in this case your DOM ready event).

Upvotes: 1

Related Questions