惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
爱范儿
爱范儿
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
博客园 - 叶小钗
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
云风的 BLOG
云风的 BLOG
量子位
博客园 - 三生石上(FineUI控件)
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
V2EX
人人都是产品经理
人人都是产品经理
V
Visual Studio Blog
Jina AI
Jina AI
L
LangChain Blog
M
MIT News - Artificial intelligence
MongoDB | Blog
MongoDB | Blog
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
WordPress大学
WordPress大学

Blog of Simple Analytics

The EU wants to kill cookie banners Google is tracking you (even when you use DuckDuckGo) German court rules Meta’s tracking tech violates GDPR Closing the data gap - Simple Analytics x Usercentrics The EU-US data deal may be dead in the water You are missing 20% of your website data with GA4 How a reverse trial will push Simple Analytics to the next level Google will start tracking all your devices (WTF?) Big Tech Fails EU’s Digital Services Act: Only Wikipedia Passes the Test Meta fined $102 million by the Irish Data Protection Commission Europeans spend 575 Million hours per year clicking cookie banners The most interesting GDPR fines GDPR and fines: all there is to know Google loses key antitrust case Web Analytics for Crypto Companies Web analytics for publishers Google pulls Uno Reverse card: Rolls back decision to kill third-party cookies Privacy Monthly July 2024 Privacy Perspectives June 2024 Privacy Monthly June APRA fumbles targeted advertising Privacy Monthly May Meta loses key privacy battle Google delays cookie phase-out once again Privacy Monthly April 2024 Web Analytics and Consent Cookies 101 Privacy Monthly March 2024 German authority cracks down on cookie banners Google Tag Manager vs Google Analytics
How to add video tracking using Google Tag Manager?
Iron Brands · 2023-04-24 · via Blog of Simple Analytics

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!

  1. Set up video tracking events
  2. Add video tracking with Google Tag Manager
  3. Tigger video tracking events
  4. Final Thoughts

Michelin chose Simple AnalyticsJoin them

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.

video-test.png

Follow these steps to set up Google Tag Manager with Simple Analytics to track video events:

  1. Open Google Tag Manager and create a new tag called "Video Events."
  2. Set up a custom trigger for YouTube videos by clicking the "+" button in the top right corner and selecting "YouTube Video" from the list.

video-trigger.png

  1. Enable "Start" and "Complete" events and ensure that "JavaScript API" is enabled in the "Advanced" section.

video-javascript-enable.png

  1. Save the trigger configuration.
  2. 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."

  1. Save the tag configuration and go to "Variables" to configure the built-in variables for these video events.

video-variables.png

  1. Select "Provider," "Status," "URL," and "Title" under the "Video" section.
  2. 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.

video-dashboard.png

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.