What is checked first: Event or Conditions?

If I use a “visibility” trigger in Piwik Tag Manager with a condition like “Page URL contains “xyz””, how does the trigger work effectively? Does it check for visibility and ONLY if the visibilty criterion is true, it checks the condition for the Page URL? Or does it only check for visibilty after it validates that the condition (Page URL contains “xyz”) is true?

The second one would be much better because visibilty checks can be performance-intense. But I fear Piwik offers only the first one, and then it is “back to Custom Code” again if I want it differently… :wink:

How are the visibilty checks implemented btw? Via MutationObserver Events or is it simple polling (check for element and visibility every x milliseconds)?

1 Like

The “visibility” trigger (I presume that you are referring to the Element presence trigger here :sweat_smile:) first checks if there is a certain element on site and only if this criterion is matched, then it checks the condition for the Page URL or rest of the values. So, your first description of the logic would apply here.

I think that going “back to Custom code” is a solution in case you would like to achieve a different behavior. You could create a custom code tag that would have a Page View trigger with a condition being Page URL contains xyz and in the custom code add an if statement that would check if there is an element available on site.

The element presence trigger is based on MutationObserver functions, so we do not check if the visitor scrolled to the element on page, we only only look at the DOM and listen for changes in it.

Thanks, Mutation Observer can get quite intense when the page is very interactive and has lots of always changing DOM stuff (eg sliders). So I will use “element presence” with great care only.