Riveted: Measuring Active Time in Google Analytics

Tracking social engagement was the hot pursuit in 2013 but it’s a new year now and the scramble is on for the next killer KPI. Early signs suggest the prize may be a sort of metric vérité: Sure, our users are engaged…but are they really engaged?

Engaged Time™, Attention Minutes™, Total Time Reading™, Is Anyone Even Actually Looking At This Web Page™. These metrics are all coming to an “Are we doing this??” email near you. And you better be ready. I may be able to help.

First, you can forget about engagement. What matters now isn’t whether your audience is engaged—it’s whether they’re riveted. Utterly riveted. For this we need a new metric. Here you go: Average Riveted Minutes Per User. ARMPU.

The best part is you can start measuring ARMPU today, using everyone’s favorite, Google Analytics.

But Seriously

OK, all joking aside. Let’s get real. Let’s talk about analytics.

Google Analytics is great. It does so many things so well that we all take it for granted. But one thing it’s not great at is measuring how much time someone actually spends on a site. This is because the main way GA measures time is by calculating the time difference between pageviews.

This worked well in the old Urchin days when browsing the web meant dialing up, loading one of your favorite bookmarks and spending 45 minutes clicking through a single site.

Things have changed. Now, many (most) visits only register a single pageview. This is OK! That single pageview might have lasted 10 minutes and it might have been the highlight of someone’s day. But in GA’s savage dashboard this is chalked up as a Bounce and tallied up as a visit lasting zero seconds.

We shouldn’t disparage GA for this. They have a lot of mouthes to feed—basically every mouth on the internet. But that doesn’t mean we can’t do better.

In a Weary World, a Plugin

Google provides a few APIs for interacting with Google Analytics programatically. If you can work out the logic for measuring something yourself (i.e., on the client) you can send events back to Google Analytics where you can view your custom metrics along with the rest of your data. We’ve all been doing this for years, using GA Events to track everything from PDF downloads to page metadata to external links.

A few years ago I started using some of this custom tracking to measure how far down a page users were scrolling. Later I abstracted the code into a little plugin called Scroll Depth.

Recently I did the same thing to measure how much time users spent actively engaged during a visit. That led to another plugin, Riveted.

How it Works

Riveted is a small bit of JavaScript that basically runs a stopwatch on active users. Scrolling, typing, clicking, and moving the mouse are actions the plugin listens for to determine whether the user is probably paying attention to the page. If a user fails to register any of these actions within a 30-second window, it considers the user idle. It also checks to make sure the tab is currently visible (for browsers that support the Page Visibility API) and marks the user as idle as soon as they switch to another tab.

If a user is active we ping Google Analytics every 5 seconds (or whatever interval you choose) with a GA Event.

Under the Events section of Google Analytics you’ll see an Event Category called Riveted and within that you’ll see a row for each time increment (5s, 10s, 15s, etc). The Event Value shows you the total number of active/engaged/riveted seconds.

At first glance it might seem cumbersome that each time increment has its own label. But logging time this way allows us to use the time values to build Advanced Segments. For instance, you could create a segment of all users that spent more than X number of minutes actively engaged.

The script also sends a User Timing event for the first user interaction. This gives you a measure of how much time passes before a user starts interacting with the site.

Rob, Why Do You Hate Chartbeat?

Chartbeat is awesome. I’ve been using it for years and I love it. If anyone deserves credit for defining the whole engaged time thing it’s them, because they were doing this stuff years ago.

But not everyone has the budget for a paid analytics service. Riveted provides engaged time tracking for the masses.

Also, even if you are using a slick service like Chartbeat, there’s a benefit to having this data in Google Analytics where you can cross reference it against all your other metrics.

A Few Technical Notes

Most of the implementation information is on the project page but I wanted to mention a few things.

The plugin provides options for setting the reporting interval and the idle timeout interval. It’d be a good idea to review Google’s collection quotas to see if you should increase the reporting interval. The current default is 5 seconds but I may bump it up to 10. The default idle timeout window is 30 seconds.

There are two methods available for manually starting and stopping the clock. An example use for these would be if you wanted to keep the user’s status active while video or audio played.

By default, the plugin sends events with the Non-interaction option set to true. This prevents the plugin from affecting the bounce rate and standard Visit Duration. This is important. If you want you can set this option to false. Two things will happen.

  1. The displayed Bounce Rate will drop to about zero. This is because any user activity—scrolling, moving the mouse, etc—will negate the bounce.
  2. The displayed Visit Duration will go way up. This is because every user activity keeps the visit clock going. On its own this isn’t a bad thing; you’re actually getting a much more accurate measure of average visit duration. But it may create a drastic jump in data, making trend analysis for the metric a mess.

So, just make sure you know what you’re doing if you change this option. If you screw up your KPI reports and your boss is all, “Greg, WTF” it’s not my fault.

And that leads me to one last point, which is that this is a beta thing. There may be bugs and if you discover one it would be great if you left a note over on Github.