Fire GTM triggers on element visibility
All projects, pages, scenes & elements will receive a specific ‘id’ when they’re published to a live URL with Maglr. You can use GTM then to fire triggers based on these element ID’s in order to track actions, such as:
Scene views
Element views
Specific scroll depth
Pop-ups clicked
In order to retrieve these ID's, we need to dive into the HTML-code of our project. The 'section ID' in the HTML code represents your scenes, while anything from 'img id' to 'div id' will represent the specific ID of your elements.
In GTM, you want to create an 'Element Visibility' trigger and set the 'selection method' to 'ID'. You can then enter the Scene or Element ID into the available text area and define its triggering conditions.
When configured correctly, the trigger will look similar to this:
Scene views
Element views
Specific scroll depth
Pop-ups clicked
Finding Scene & Element ID's
In order to retrieve these ID's, we need to dive into the HTML-code of our project. The 'section ID' in the HTML code represents your scenes, while anything from 'img id' to 'div id' will represent the specific ID of your elements.
Creating the trigger in GTM
In GTM, you want to create an 'Element Visibility' trigger and set the 'selection method' to 'ID'. You can then enter the Scene or Element ID into the available text area and define its triggering conditions.
When configured correctly, the trigger will look similar to this:
Updated on: 08/02/2023