{"id":2347,"date":"2021-05-05T09:38:32","date_gmt":"2021-05-05T08:38:32","guid":{"rendered":"https:\/\/www.jurecuhalev.com\/blog\/?p=2347"},"modified":"2021-05-05T09:38:32","modified_gmt":"2021-05-05T08:38:32","slug":"average-play-time-duration-in-google-analytics","status":"publish","type":"post","link":"https:\/\/www.jurecuhalev.com\/blog\/average-play-time-duration-in-google-analytics\/","title":{"rendered":"Average Play Time duration in Google Analytics"},"content":{"rendered":"\n<p>I\u2019ve 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:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Average playtime<\/li><li>Distribution of playtime<\/li><li>Total playtime<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Inspiration<\/h2>\n\n\n\n<p>I was greatly inspired by this article on&nbsp;<a target=\"_blank\" href=\"https:\/\/www.charlesfarina.com\/video-tracking-google-analytics\/\" rel=\"noreferrer noopener\">Video Tracking (The Right Way) for Google Analytics<\/a>&nbsp;as it\u2019s 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\u2019s possible to implement.<\/p>\n\n\n\n<p>I recently found&nbsp;<a target=\"_blank\" href=\"https:\/\/www.cardinalpath.com\/blog\/enhanced-google-analytics-tracking-for-video-publishers\" rel=\"noreferrer noopener\">Enhanced Google Analytics Tracking for Video Publishers<\/a>&nbsp;that describes this process in more detail. It describes two different approaches: heartbeat and milestone approach.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>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\u2019t send a specific&nbsp;<strong>total view time<\/strong>&nbsp;at the end of viewing sessions as you can\u2019t be sure that you\u2019ll have a chance to transmit the information.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Problem: It\u2019s hard or impossible to send accurate events from mobile devices<\/h2>\n\n\n\n<p>It would be nice if we could send an event when the user navigates away from our website. It turns out that it\u2019s not something you can reliably do. There are multiple reasons:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Window\/unload_event\">unload() event is so unreliable<\/a>\u00a0that 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.<\/li><li>Mobile devices allow playing audio and sometimes video on the lock screen or in Picture in Picture mode. In such cases, you sometimes don\u2019t get any javascript calls back to the website and you can\u2019t log events to your analytics.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Problem: Google Analytics is append-only with very limited statistics<\/strong><\/h2>\n\n\n\n<p>In a perfect world, we\u2019d send heartbeat events for a specific user&#8217;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\u2019t figure out how to do this with a free version of Google Analytics and I have a hunch it\u2019s not possible. I think that just the sheer complexity of such calculation is outside of the scope of Google Analytics.<\/p>\n\n\n\n<p>This means that we can\u2019t get accurate numbers and that the best thing we can do is go with milestone approximation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How does it look in practice?<\/h2>\n\n\n\n<p>I\u2019ve 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.<\/p>\n\n\n\n<p>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!<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"745\" height=\"451\" src=\"https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/05\/progress.png\" alt=\"\" class=\"wp-image-2348\" srcset=\"https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/05\/progress.png 745w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/05\/progress-550x333.png 550w\" sizes=\"auto, (max-width: 745px) 100vw, 745px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"746\" height=\"452\" src=\"https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/05\/minutes.png\" alt=\"\" class=\"wp-image-2349\" srcset=\"https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/05\/minutes.png 746w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/05\/minutes-550x333.png 550w\" sizes=\"auto, (max-width: 746px) 100vw, 746px\" \/><\/figure>\n\n\n\n<p>One interesting side effect of adding these analytics to the system is that our average session duration went up drastically. I think it\u2019s easy to under-measure things if you have a website that isn\u2019t part of the normal e-commerce or marketing funnel style page.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"984\" height=\"163\" src=\"https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/05\/avg-duration.png\" alt=\"\" class=\"wp-image-2350\" srcset=\"https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/05\/avg-duration.png 984w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/05\/avg-duration-550x91.png 550w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/05\/avg-duration-768x127.png 768w\" sizes=\"auto, (max-width: 984px) 100vw, 984px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What I wish I could do better inside Google Analytics<\/h2>\n\n\n\n<p>If you look at the screenshots closely you can see that report is showing individual ratio percent of each event action. What I\u2019d like to have is a way to link these events together into series so I could indicate funnels much better.<\/p>\n\n\n\n<p>Building these \u2018per video\u2019 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.<\/p>\n\n\n\n<p>Get better averages and statistics around Event Values.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Lessons learned and looking forward<\/h2>\n\n\n\n<p>Implemented is always better than perfect. Even with such a rough measurement approach, we\u2019ve started seeing user patterns that were hidden from us before.<\/p>\n\n\n\n<p>A free version of Google Analytics is amazing but at some point, we\u2019ll have to look into implementing a different technology. It\u2019s 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.<\/p>\n\n\n\n<p>In the future, I want to look into&nbsp;<a target=\"_blank\" href=\"https:\/\/plugins.matomo.org\/MediaAnalytics\" rel=\"noreferrer noopener\">Matomo with the Media Analytics plugin<\/a>. It seems that it offers some of the more advanced functionality.<\/p>\n\n\n\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I\u2019ve 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 Inspiration I was greatly inspired by this article on&nbsp;Video [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2350,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[14],"tags":[],"class_list":["post-2347","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech"],"acf":[],"jetpack_featured_media_url":"https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/05\/avg-duration.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/posts\/2347","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/comments?post=2347"}],"version-history":[{"count":1,"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/posts\/2347\/revisions"}],"predecessor-version":[{"id":2351,"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/posts\/2347\/revisions\/2351"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/media\/2350"}],"wp:attachment":[{"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/media?parent=2347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/categories?post=2347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/tags?post=2347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}