Auto-events trigger - Google Tag Manager

Overview

In this article, we're gonna talk about a feature of GTM, and this is the interaction tracking via Auto-Event triggers.

Introduction

Once you deploy a trigger through Google Tag Manager, it will be the instance that decides whether a tag should be deployed and be able to transfer data over to the marketing vendor, in our case, Google Analytics.

In the case of these special Auto-Events triggers, like clicks trails or from trails, there are two more functionalities that these triggers carry. One is the listener, and the second one is the filter that decides whether a tag should fire o not.

Let's look at a Google Analytics example:

Well, let's say you have GTM installed on a website and an Auto Event trigger installed. This trigger will listen for every interaction on that page based on the event that you choose, and send the data over to GTM and then, depending on your filter settings within you trigger, this will lead to a tag deployment or prevention of that tag deployment when an interaction is registered.

How we can pick up interactions with the help of Google Tag Manager.

Auto-Event Clicks

By default, GTM does not track click, but if you need it, you can configure it by yourself.

Generic Click.

GTM listens to clicks of all elements on a web page. If you click on a page title, image, or background, all clicks will be tracked by the click listener and you’ll see those events in the GTM Preview and Debug mode.

  1. Go over to GTM and make sure in your variable menu that has your click built-in variables activated.
    1. if that is not the case, you can go to the Configuration button and scroll down to your Clicks variables and make sure that they are all enabled.
  2. Create a generic Click trigger
    1. Navigate to Triggers section
    2. Click on New trigger
    3. Set a title
    4. Goes into the Configuration, and choose ALL Elements on Click section. All clicks fire on option ticked in order to pick up all the clicks that are happening on the website.
    5. Save Trigger
  3. Goes into Preview and Debug mode
  4. Reload your website
  5. You must see whether the listener(trigger) work.
  6. If you click anywhere on the website, you can see a new gtm.click event was initiated. If you click on this event, you can look into the variables to be able to see click variables that you have just enabled.

    Note

    These click variables will be automatically filled by Google Tag Manager depending on what you're clicking on. These variables you can use for your filter in order to only fire when somebody clicks on a specific element. Next section.

Specific Click

In order to create a precise trigger that tracks clicks for only the specific button, following the next steps.

  1. Goes to specific click trigger
  2. Configure your trigger
    1. Change the fire option and click Some clicks.
    2. Choose your variable that you want to filter down on, it could be for example a Click Class, which should contain btn btn-feedback. Notice how is using the CSS Selector.
  3. Save your trigger
  4. This trigger needs to be tested in conjunction with tags, so
    1. Create a Tag
    2. Set title
    3. Set Tag configuration 
    4. Attach your Search trigger
    5. Save
  5. Refresh Debug mode.
  6. Reload your website
  7. Click on your Search button.
  8. Validate your tag is fired.

Auto-event Page View

Track a page view. By default, it is not fired with GTM.

There are three separate trigger types choose from

  • Page View fires when the GTM container code is loaded on the page. It fires even before you can see the page content. This trigger is the most basic trigger which is used often to fire a Pageview Tag. This is our “as soon as possible” trigger.
  • DOM Ready fires when the Document Object Model is ready, which means the browser is finished putting all the HTML elements in their appropriate positions. We use this if we need something to be present on the page before we fire a tag.
  • Window Loaded is the last chronologically and fires when the browser has finished rendering and displaying everything on the page.


  1. Go over to GTM and make sure in your variable menu that has your page built-in variables activated.
    1. if that is not the case, you can go to the Configuration button and scroll down to your Page variables and make sure that they are all enabled.
  2. Create a Page view trigger
    1. Navigate to Triggers section
    2. Click on New trigger
    3. Set a title
    4. Goes into the Configuration, and choose Page view Type. All page views fire on option ticked in order to pick up all the pages that are visited on the website.
    5. Save Trigger
  3. Goes into Preview and Debug mode
  4. Reload your website
  5. You must see whether the listener(trigger) work.
  6. If you visit any page on the website, you can see a new PageView event was initiated. 

Auto-event JavaScript Error trigger

Google Tag Manager can handle JavaSript errors event if you configure it. It is used to fire tags when an uncaught JavaScript exception occurs.

  1. Go over to GTM and make sure in your variable menu that has your Errors built-in variables activated.
    1. if that is not the case, you can go to the Configuration button and scroll down to your Errors variables and make sure that they are all enabled.
  2. Create a generic Click trigger
    1. Navigate to Triggers section
    2. Click on New trigger
    3. Set a title
    4. Goes into the Configuration, and choose JavaScript Error type. All JavaScript Errors fire on option ticked in order to pick up all the Js errors that are happening on the website.
    5. Save Trigger
  3. Goes into Preview and Debug mode
  4. Reload your website
  5. You must see whether the listener(trigger) work.
  6. You can see a new gtm.error event was initiated. If you click on this event, you can look into the variables to be able to see click variables that you have just enabled.

Table of Content