Auto Event Tracking with GTM

0

There are many interactions on a site that do not result in pageviews. Non pageview based interactions do not get captured in standard Google Analytics implementation. Event tracking can be used in order to track such interactions. In this post, I’ll discuss auto-event tracking using Google Tag Manager (GTM) for the following:

  • Link Clicks
  • Page level Clicks
  • Timed Intervals
  • Form Submissions

Link Clicks:

Typically, websites have multiple links within each web page, each linking to other sections of the website. Examples of links include “Read more,” “Shop Now,” “Get the app,” “Product name,” “Contact Us,” etc. Clicking on each of these links will take users to the destination page. Clicking on “Read more” takes users to www.mysite.com/article-name/. Clicking on “Product name” will direct users to www.mysite.com/product-name/ and so on. If you want to track how many times users have clicked on specific links within your site, you will need to generate Google Analytics events for the same. Follow the steps below to set-up Link Clicks event tracking in GTM:

  1. If you have not set up page tracking already on your website, specify your basic page tracking under Tag Type:It is highly recommended you use Universal Analytics as opposed to Classic Google Analytics.
  2. Once you have set-up basic page tracking, add an Event Listener tag. You can name it “Link Click Listener”Notice that there are two check boxes (checked by default): “Wait for Tags” and “Check Validation.” The default wait time is 2 seconds. I do not recommend increasing the time-out as this will increase the page load time. The “Check Validation” option allows you to fire tags only when the action of opening a link is considered valid. In other words, the tags will fire only if the default action has not been prevented by another conflicting code in the site. If enabling “Check Validation” results in gtm.linkClick or gtm.formSubmit event not firing, it is because of a conflict resulting in link/form interaction not being considered valid. If you want your tags to fire for all instances, please uncheck “Check Validation.”
  3. Create a rule for each of the links you want to track. For example, for mysite.com/product-name/, create a rule named after the “product name” with the following conditions:{{event}} equals gtm.linkClick{{url}} contains product-name/
  4. For each link, you would like to track, follow the steps as described above with the track type being “Event.” Name each Event in such a way that it can be recognized in the future. For example, “GA Event – Buy.” Enter a Category, Action, and Label for each event. For example, for the link click “Buy” you can use the following:Category – NavigationAction – BuyLabel – {{URL} (this is an in-built macro to capture the URL)
  5. Save the latest version of the container and then ‘Publish’ it.

Page Level Clicks:

To track page level clicks, follow the steps below:

  1. If you haven’t already set-up basic analytics in your GTM container, add a new tag. Choose Google Analytics, if you would like to use GA (choose between Universal Analytics and Classic Analytics – it is strongly recommended that you use Universal Analytics).Note that the track type is “Page View.” Set up a firing rule to fire the tag on all pages.
  2. Next, to be able to track clicks, add a tag with the event type of “Click Listener”Add the following firing rules:{{event}} equals gtm.click{{url}} matches RegEx .*
  3. Add a category, Action and Label to the event. For example, you could use these:Category: AllAction: ClickLabel: {{URL}
  4. Preview and Debug the latest tag
  5. Create a container version – add a note to the container to indicate what change has been made in the new version
  6. Hit Publish!

Form Submissions:

Regardless of whether a site deals with e-Commerce or not, most sites contain form fields of one type or the other. Common forms that come to mind include: Newsletter sign-ups, account sign-ups, contact form submissions, booklet downloads, policy sign-ups, etc. Tracking form completions, visitors-to-sign-up ratio, etc. are crucial metrics that stakeholders would be interested to know. One way of tracking form completions is by assigning goals to each of the forms in your website. The other method is to track form completions as events. Here is how you will configure GTM to track Form Submissions:

    1. Set-up a “Form Submit” listener. The role of this tag is to listen for any Form Submission on your site.Select the Event Type “Form Submit Listener.” Check the following check boxes: “Wait for Tags,” and “Check Validation.” The check box, “Wait for Tags,” when checked, delays form submit until all the dependent tags have fired. The default maximum wait time is 2 seconds. I do not recommend increasing this to more than 2 seconds as it introduces additional latency to the page.The second check box, “Check Validation,” is useful to eliminate inaccuracy in form submission count. When checked, GTM only fires the Form Submit tag when the form is successfully submitted.
    2. Add firing rules for the rule to match on all pages:{{url}} matches RegEx .*
    3. Now that you have created the “Form Submit” listener, go ahead and create an event for each of your forms. For instance, you have an application form on your site. To track your applications:
      a. Name your event – GA Event – Apply Now
      b. Choose the tracking tag
      c. Specify the tracking ID – UA-11111111-1
      d. Choose the track type as “Event”
      e. Set the event tracking parameters:
      Category: form
      Action: application
      Label: {{url}}
    4. Next, create a firing rule for this event:Here, the rule is matched when users successfully complete a form submission and are redirected to the thank you page.
    5. Save a version of this update and publish it

Timed Intervals:

Site dwell time is an important metric, you might want to track. For instance, you might want to track how many times your site visitors spent more than a certain number of minutes on your site – this number could be your site average for this quarter or the previous quarter. This will give you a sense of how strongly your audience is engaged. Here is how you can configure this in GTM:

  1. If you haven’t already added a page tracking tag, go ahead and add one – Google Analytics (Universal Analytics being the preferred option!)
  2. Add a new tag – you can name the tag anything you choose. Choose the Tag Type as “Event Listener” à Timer Listener. Specify the timer interval – this will be in milliseconds. So if you want the tag to fire once users complete five minutes on the site, the value to be fed into the field will be 300000.
  3. Add the rule: {{url}} matches RegEx .*
  4. Add a rule named after the event that checks for the event you created in the step above. In this case, I have named the Event “ToS – 5”
  5. You are done. Save a version of the container and publish it.Event tracking lets you build additional context about your site’s performance beyond the standard reporting metrics. Hope you found this post useful. Please do take a moment to leave your comments in the comments section below.

You might also like

Leave A Reply

Your email address will not be published.