Tracking video plays gives you insights on user engagement with your video content on your site. With it you can gather valuable insights into their behavior and improve your content.
In this article, we'll show you the easiest way to set this up.
Let's dive in!
- Set up video tracking events
- Add video tracking with Google Tag Manager
- Tigger video tracking events
- Final Thoughts
Set up video tracking events
We will use Simple Analytics in combination with Google Tag Manager instead of Google Analytics. Using these tools setting up video tracking is 10x easier than using GA4.
Suppose you have a video on your website and want to track both when users start playing it and when they finish watching it. We'll demonstrate this process for YouTube videos, but it should apply to other video platforms too.
We have created a demo website with an embedded video to show you how to track video events.
Add video tracking with Google Tag Manager
Follow these steps to set up Google Tag Manager with Simple Analytics to track video events:
- Open Google Tag Manager and create a new tag called "Video Events."
- Set up a custom trigger for YouTube videos by clicking the "+" button in the top right corner and selecting "YouTube Video" from the list.
- Enable "Start" and "Complete" events and ensure that "JavaScript API" is enabled in the "Advanced" section.
- Save the trigger configuration.
- In the "Video Events" tag, add the custom HTML code snippet as shown below.
<script>
if (window.sa_event) {
sa_event("video_{{Video Status}}", {
video_provider: "{{Video Provider}}",
video_title: "{{Video Title}}",
video_url: "{{Video URL}}"
})
}
</script>
This checks if the "sa_event" function is available and sends video events ("video_start" and "video_complete") to Simple Analytics using variables like "Video Status," "Video Provider," "Title," and "URL."
- Save the tag configuration and go to "Variables" to configure the built-in variables for these video events.
- Select "Provider," "Status," "URL," and "Title" under the "Video" section.
- Save the variable configuration, submit your changes, and publish them to Google Tag Manager.
Tigger video tracking events
Once you've set everything up, you should refresh your website an play the video to the end to trigger the events.
Check your Simple Analytics dashboard's "Events Explorer" to see the recorded video start and complete events with metadata such as provider, title, and URL.
Final Thoughts
With this setup, you can effectively track video engagement on your website and use the collected data to improve your site's user experience and content strategy.
Simple Analytics is a website analytics tool that lets you track your most important metrics in a straightforward dashboard. You don't need the complexity of GA4. Check our live analytics dashboard to see for yourself.