DE

EN

Blog Post

Web Analytics

Nadine

Wolff

published on:

15.12.2016

Average Time Spent on Page – Track User Engagement with Google Tag Manager

Table of Contents

No table of contents available
No table of contents available
No table of contents available

Google Analytics is one of the most well-known tools that allows you as a webmaster or online marketing manager to analyze user behavior on your website. After embedding the tracking code in the source code of each of your pages, the user data is sent to Google Analytics. Depending on the tracking ID, the data flows into the Google Analytics account you created. You can analyze user behavior on your site based on this. An exciting piece of information provided by the metric 'Average time on page' in the predefined standard reports is just one example.

If you want to track elements beyond the standard tracking of Google Analytics, such as clicks on buttons or PDF downloads, we recommend implementing the Universal Analytics code via the Tag Manager. The Google Tag Manager is an additional tool that allows you to create and manage very user-friendly tags even without extensive programming knowledge. The data collected also flows into your Google Analytics account via the tracking ID (UA number).

Previous articles on the Google Tag Manager:

Know how long users stay on your pages

A standard metric in Google Analytics reports is 'Average time on page'. It indicates how many seconds or even minutes the user spends on individual pages. However, there is a problem with this metric. Google Analytics can only determine the correct time if the user visits at least one more page. Otherwise, if only a single page is accessed during the session, Google Analytics will measure the exit or bounce with the last page. The principle is: When a user opens a page, a page view is sent to Google Analytics and recorded in the reports. The time or duration is measured from this point. If the user subsequently accesses a new page on another domain, this is not detected because no tag triggers. Instead, the time is measured continuously until the session officially ends after 30 minutes (unless otherwise set).

The Google Tag Manager can help here with a custom HTML code to determine the real time a user spends on the page. This topic is particularly intriguing for blog operators.

Imagine a user is searching for a specific topic, finds your article or post via Google, reads it completely, and then leaves the page again. The user would be counted as a bounce, increasing the bounce rate. The duration cannot be accurately recorded and is thus set to 0:00 min. The same applies to every landing page. However, this behavior drastically distorts your analysis, even though the user is essentially doing exactly what you hope. They are thoroughly informed on your site.

How to measure the duration of a user with the Google Tag Manager

In this article, we assume you are already using the Tag Manager for implementing Universal Analytics tracking. Otherwise, we recommend performing the basic configuration of the Tag Manager beforehand.

To measure the actual visit time for every page view, you need to create two tags, two data layer variables, and a trigger in your container's workspace.

Let's start by creating two data layer variables. To do this, navigate to the variables in the left navigation bar and add two new data layer variables for the event label and event value. The new custom variables look as follows:

01 - Datenschichtvariable - Ereignislabel

Figure 1: Setting the data layer variable - event label


02 -Datenschichtvariable - Ereigniswert

Figure 2: Setting the data layer variable - event value


The two variables are important so that the data from the function in the following HTML script is correctly recognized and the events are transferred to Analytics.

To create the first tag, click NEW on the left in your workspace and select the custom HTML tag.

03-Benutzerdefiniertes HTML Tag einfügen

Figure 3: Creating a custom HTML tag


The custom tag allows you to manage tags that aren't directly supported in the Tag Manager.

The function above is written so that every 10 seconds an event 'Riveted' triggers and measures the number of seconds of the page visit. The event only triggers if the user's browser window is active and the user performs one of the following actions:

  • Moving the mouse

  • Scrolling with the mouse

  • Clicking the mouse

  • Typing on the keyboard

If the user then continues working in a second tab or another program, the tracking will not trigger after 60 seconds. If they return to the page without reloading the window, the event would resume.

For this tag, set 'DOM fully loaded' as the trigger. This means the tag triggers when the browser has read the source code from top to bottom once. This point should not be confused with when the page is completely loaded and displayed to the user.

The finished tag looks as follows.

04 -Benutzerdefiniertes Tag

Figure 4: Custom tag in Google Tag Manager


The second tag to be created is a Universal Analytics tag of the event type. You should adopt the settings as shown in the following screenshot.

05 -Einrichtung des Analytics-Tags

Figure 5: Setting up the Universal Analytics tag


Make sure you don't forget to anonymize the IP address and set the 'Non-interaction hit' field to 'true'. This means that this event does not affect the bounce rate, as it is not considered an interaction with the page. That is, if, for example, a user accesses one of your pages, reads the content, and keeps the page open and active for a long time but does not access a second page, the session counts as a bounce, but the visit time is captured via event tracking.

Set the tag to trigger at the custom event with the event name 'Riveted'. This event name is defined in the custom HTML tag. Every 10 seconds, as long as the user is on the page, the event with the name 'Riveted' triggers, and at this moment, the above-configured second tag should trigger and send the values to Google Analytics.

06 - Trigger für Analytics-Tag

Figure 6: Trigger settings for the Universal Analytics tag


Time on page as event tracking in Google Analytics

After you have correctly created and published the two tags, the variables, and triggers, you can see the length of stay of your users in Google Analytics.

To do this, navigate in the Analytics interface to Behavior - Events - Top Events.

You can then select 'Engagement' as the event category, or the category you named in the tag.

In the next layer, the event action, click on 'Time on page' and then see the duration of stay of users in seconds as the event label.

Use 'Page' as the secondary dimension to determine the visit time for each page.

07 -Navigation zu wichtigsten Ereignissen bei Google Analytics

Figure 7: Navigation in Google Analytics to events


How can we support you

If you have further questions about the article or would like support in the area of web analysis, we look forward to your inquiry via our contact form or by phone.

Nadine

Wolff

As a long-time expert in SEO (and web analytics), Nadine Wolff has been working with internetwarriors since 2015. She leads the SEO & Web Analytics team and is passionate about all the (sometimes quirky) innovations from Google and the other major search engines. In the SEO field, Nadine has published articles in Website Boosting and looks forward to professional workshops and sustainable organic exchanges.

Address

Bülowstraße 66

Aufgang D3

10783 Berlin

Legal Information

Newsletter

Address

Bülowstraße 66

Aufgang D3

10783 Berlin

Legal Information

Newsletter

Address

Bülowstraße 66

Aufgang D3

10783 Berlin

Legal Information

Newsletter