Triggers in GTM

A trigger is used to witness an interaction and to decide whether a tag should be triggered or not. Google Tag Manager can spontaneously “listen” for actions happening on the web page. When an action occurs on page, tag manager will compare it against a list of anticipated interactions, alias triggers, and if a match is found, tag manager will take action and fire the matching tag. A tag must have minimum of one trigger in order to fire.

A trigger is collection of one event and one or more filters (with the exception of custom events, which don’t require a filter). Each filter takes the form: <Variable> <Operator> <Value>triggers-in-gtm-1From the above screenshot, the variable “Page URL”, ‘Click ID’ and ‘Click Classes’ is evaluated during runtime. The above variable has been defined such that it contains the current page URL and click elements. Thus, during runtime, the current page URL and click element are compared to the value provided in the above screenshot. If all the conditions are met the trigger will fire; else it won’t fire.

Types of triggers in Google Tag Manager

All tag firing in Google Tag Manager is action- or event-driven. Any time an event or action is recorded by Google Tag Manager, triggers from the container are assessed and corresponding tags are fired. No tag can be fired unless an action or event occurs. GTM has 6 built-in event types plus a custom event option

1. Page View listens for the page being fully loaded and ready to view. GTM provides a built-in page view trigger.triggers-in-gtm-22. Click trigger listens for any click on the page (on any type of elements)
There are two different trigger types for click trigger:

  •   All Elements will exactly fire anytime the mouse is left clicked. This could be on an image, a link, a button, or form element.
  • Just Links fires only when an HTML link is clicked on.triggers-in-gtm-3

3. Form Submission fires when a form is successfully validated and submitted
Here is an example to track a form with id equal to formid on any form page

  •  Choose Event: Form Submission
  • Configure Trigger: Select Check Validation
  • Fire On: Form ID  equals formidtriggers-in-gtm-4

4. History Change fires when the browser history changes, i.e. a page change

5. JavaScript Error fires when the scripts error out

6. Timer fires after an interval of time

7. Custom Event trigger listens to the events being pushed via the dataLayer
For example, you need to track how many people use the product sort option on an ecommerce site. What would be the best choice now? Obviously a custom event. Custom Events are used to capture the actions that were pushed into the dataLayer. The dataLayer is a code used to pass data about both page content and user actions or interactions to Google Tag Manager.triggers-in-gtm-5To sum it up, triggers work like magic. It’s vital for usability to have them combined into the workflow as they are now.

If you like my articles,