Skip to content

Average Play Time duration in Google Analytics

I’ve recently had a challenge where I have a website that has video and audio content. I wanted to log events into Google Analytics in a way that would allow me for each media to have the following stats:

  • Average playtime
  • Distribution of playtime
  • Total playtime


I was greatly inspired by this article on Video Tracking (The Right Way) for Google Analytics as it’s displaying a vision of a good dashboard for a multimedia heavy web property. The main issue is that it was never clear to me how much of that is aspirational and how much it’s possible to implement.

I recently found Enhanced Google Analytics Tracking for Video Publishers that describes this process in more detail. It describes two different approaches: heartbeat and milestone approach.

The heartbeat approach is where the client (web site) sends an event every X minutes to indicate that the user is still watching our material.

Milestone approach is where we have split our video in distributed chunks such as every 10% and send the event back to Analytics when a user reaches that chunk.

Both milestone and heartbeat approach have an issue that you can potentially lose the last chunk of information if the user navigates away from the web page and you send that last event for one of many reasons (see below). This also means that you can’t send a specific total view time at the end of viewing sessions as you can’t be sure that you’ll have a chance to transmit the information.

Problem: It’s hard or impossible to send accurate events from mobile devices

It would be nice if we could send an event when the user navigates away from our website. It turns out that it’s not something you can reliably do. There are multiple reasons:

  • unload() event is so unreliable that MDN says to not even bother using it on mobile. With more than 50% of traffic being on mobile devices these days this carries a serious measurement error.
  • Mobile devices allow playing audio and sometimes video on the lock screen or in Picture in Picture mode. In such cases, you sometimes don’t get any javascript calls back to the website and you can’t log events to your analytics.

Problem: Google Analytics is append-only with very limited statistics

In a perfect world, we’d send heartbeat events for a specific user’s video session and just append the last total view time to that heartbeat event. Then in the next step, we could filter out these sessions in a way that would only read the last heartbeat value and not the ones that came before. I couldn’t figure out how to do this with a free version of Google Analytics and I have a hunch it’s not possible. I think that just the sheer complexity of such calculation is outside of the scope of Google Analytics.

This means that we can’t get accurate numbers and that the best thing we can do is go with milestone approximation.

How does it look in practice?

I’ve implemented two approaches: 10% segments and 5-minute chunks. This way I can measure the overall completion rate of videos across the site and at the same time get a feeling for the number of time users are viewing the content.

These are two views of the same video recording. As you can see it has a good completion rate of about 50% people getting to the end and most of them getting to the approximate total time of the video (44 minutes). Some of them even went back and rewatched some parts!

One interesting side effect of adding these analytics to the system is that our average session duration went up drastically. I think it’s easy to under-measure things if you have a website that isn’t part of the normal e-commerce or marketing funnel style page.

What I wish I could do better inside Google Analytics

If you look at the screenshots closely you can see that report is showing individual ratio percent of each event action. What I’d like to have is a way to link these events together into series so I could indicate funnels much better.

Building these ‘per video’ reports requires a lot of clicking each time we publish a new video. It would be good to have a way to automatically generate a report for each in Google Analytics.

Get better averages and statistics around Event Values.

Lessons learned and looking forward

Implemented is always better than perfect. Even with such a rough measurement approach, we’ve started seeing user patterns that were hidden from us before.

A free version of Google Analytics is amazing but at some point, we’ll have to look into implementing a different technology. It’s probably going to be supplemental and understanding the limits of the existing one will be invaluable in looking at use cases for whatever we choose.

In the future, I want to look into Matomo with the Media Analytics plugin. It seems that it offers some of the more advanced functionality.

Gathering data is an easy part. Now the bigger challenge is how to distill this into a format that offers actional insights for the content team.