Report Engagement Time with Google Tag Manager

This post may contain affiliate links. I may receive a commission for purchases made through these links.
Report Engagement Time in Google Analytics with Google Tag Manager

I tried to follow Simo Ahava‘s tutorial on how to report a user’s engaged time on a page, but I kept getting lost in his instructions. Simo is a developer, so he really understands how to create the javascript in order to report engagement time. I, on the other hand, am not well-versed in javascript where I can create something from scratch. So that’s what lead me to write this.


In this post, for my own sanity, I’m going to try to create a how to that I’ll be able to follow later on. This is an extremely useful metric to apply to Google Analytics account and I would like to easily set this up for future clients without all the headache from my first go-round.

I even signed up for Chris Mercer’s Measurement Marketing courses and tried to follow his video tutorial and I was still lost because Google Tag Manager was different in 2016 when the video was recorded.

We’re going to go a little back-and-forth between Google Analytics and Google Tag Manager, so keep them open in two tabs.

1. In Google Analytics, go to Admin > go to Custom Definitions: Custom Metrics > click on New Custom Metric (if you don’t see the big red button, then check to make sure you have the appropriate permissions).

Create New Custom Metric Google Analytics 2020

Name this new custom metric ‘Total Engaged Time‘ and set the formatting type to ‘Time‘ and make sure that the Active box is checked.

Create Custom Metric GA 2020

Go ahead and save at you’ll see that you have created the new custom metric. Take note of the index number as we’ll use that in a later step.

Create new custom metric GA 2020

2. In Google Tag Manager, Create Custom Event Trigger ‘gtm.dom’

Create GTM Event gtmdom 2020

3. Create Custom Event Trigger ‘nonIdle’

Create GTM Event nonidle 2020

4. Create Data Layer Variable ‘nonIdeleTimeElapsed’

Create GTM GLV nonIdleTimeElapsed 2020

5. Create Data Layer Variable ‘Interactive Engagement in Secs’

For this step, you’re going to want to head over to Simo’s website and copy the script he wrote in Step #4. Create a new data layer variable with custom javascript, then paste in the code.

Create GTM DLV interactive engagement 2020

6. Create a New Tag in Google Tag Manager

For this step, you’re going to want to head over to Simo’s website and copy the script he wrote in #1. Create a new tag in your own account for custom HTML, then paste in the code. For the trigger, select the custom event you created in step #2 ‘gtm.dom’ then save.

Create GTM Tag Simo Ahava Script 2020

7. Create a Second New Tag

You’ll want to select Google Analytics: Universal Analytics for the tag type. For this one it will be an event.

Create GTM Tag GA Event 2020

Fill these out in the event parameters:

    • Category: Engaged Time
  • Action: {{Page URL}}
  • Label: {{Interactive Engagement in Secs}}
  • Non-Interaction Hit: True

Create GTM Tag GA Event tracking parameters 2020

Add your Google Analytics settings and check the box to ‘enable overriding settings in this tag’ which will give you more options.

Fill out these settings under More Settings:

  • Fields to Set – Field Name: transport
  • Fields to Set – Value: beacon
  • Custom Metrics – Index: 1
  • Custom Metrics – Metric Value: {{Interactive Engagement in Secs}}

The Index number refers to the custom metric that we created in step #1 above. Since this was my first custom metric, Google Analytics created the index of 1. This number might be different for you, so be sure to refer back to your Google Analytics account.

Create GTM Tag Event 2020 More Setting 2020

For the trigger, you’ll want to apply the custom event we created in step #3, then save. Go ahead and publish your container!

Create GTM Tag Firing Event nonIdle 2020

8. In Google Analytics, Add Calculated Metric

Go to Admin > View: Calculated Metrics > + New Calculated Metric

GA Create New Calculated Metric 2020

Next, you’ll want to set the metric like this:

  • Name: Average Engagement
  • Formatting Type: Time
  • Formula: {{Total Engaged Time}} / {{Pageviews}}

Create GA New Calculated Metric
9. Create Google Analytics Custom Report

Create a custom report titled ‘Content Engagement’ with the following:

  • Pageviews
  • Total Engaged Time
  • Average Engagement
  • Avg. Time on Page


  • Page
  • Source/Medium

Create GA Custom Report 2020

That’s it! You have completed this simplistic guide on how to report engagement time in Google Analytics with Google Tag Manager. If you would like to learn more about the reasoning behind each step, make sure to head over to Simo Ahava’s website in the resources at the top of this post. He explains each step beautifully while answering the why.

Again, this guide is to help me have a quick step-by-step to get the setup complete in a quick, simple manner. This helps me and I hope it helps you.


Leave a Reply

Your email address will not be published. Required fields are marked *