Measuring the performance of a video is important for a variety of reasons. It can help identify areas for improvement, compare the video's performance to similar content, optimize distribution, and evaluate the success of marketing efforts. Additionally, tracking metrics can provide insight into audience preferences, allow for the calculation of return on investment, and identify trends in audience behavior. Overall, regularly measuring the performance of a video is essential for maximizing its effectiveness and achieving desired business objectives.
To track video plays with Logspot, you can use the track
method in the Logspot JS SDK. This method allows you to track custom events in your web application, and provide insights into your user's behavior and engagement with your web application.
Here is an example of how to use the track
method to track video plays with Logspot:
import Logspot from "@logspot/web"; const trackVideo = () => Logspot.track({ event: "VideoPlay", metadata: { videoId: "123456", }, });
In this example, we are using the track
method to track a custom event called "VideoPlay" in our web application. The event
parameter specifies the name of the event that we want to track. We are also using the metadata
parameter to attach additional data to the event, in this case the videoId
of the video that was played.
Once you have implemented the track
method, Logspot will track video plays in your web application, and provide insights into your user's behavior and engagement with your web application. This will allow you to better understand how your users are interacting with your web application, and make data-driven decisions to improve the user experience.
Here is an example of how to use the track
method to attach Logspot tracking to a video player:
import Logspot from "@logspot/web"; const trackVideo = () => Logspot.track({ event: "VideoPlay", metadata: { videoId: "123456", }, }); const player = document.getElementById("player"); player.addEventListener("play", () => { trackVideo(); });
To attach this tracking to a video player, we are using the addEventListener
method to listen for the play
event on the video player element. When the play
event is triggered, we are calling the track
method to track the "VideoPlay" event.
Simplifying the progress tracking for a video can help provide general information about engagement with the video. By detecting when each percentage step is played, you can gain insights into how much of the video is being watched, and potentially identify areas where viewers may be losing interest. This information can be useful for improving the video content or making changes to the way it is presented to increase engagement.
import Logspot from "@logspot/web"; const player = document.getElementById("player"); player.addEventListener("timeupdate", () => { const progress = player.currentTime / player.duration; const thresholds = [0.25, 0.5, 0.75, 1]; const eventIndex = thresholds.findIndex((threshold) => progress >= threshold); if (eventIndex >= 0) { Logspot.track({ event: `VideoProgress${thresholds[eventIndex]*100}`, metadata: { videoId: "123456", }, }); } });
This code uses the timeupdate
event to track the progress of a video. It calculates the current progress by dividing the currentTime
of the video by its duration
. It then defines a set of thresholds, representing the 25%, 50%, 75%, and 100% points in the video.
The code then uses the findIndex()
method to determine which threshold has been reached, and if any of the thresholds have been reached, it uses Logspot to track an event with the name VideoProgress
followed by the percentage of the video that has been played. For example, if the progress of the video reaches 75%, the event would be named VideoProgress75
. The event also includes metadata about the video, such as its videoId
.
Here is an example of how to use the track
method to track how many people watched the video with sound with Logspot:
import Logspot from "@logspot/web"; const player = document.getElementById("player"); player.addEventListener("volumechange", () => { if (player.muted) { Logspot.track({ event: "VideoMuted", metadata: { videoId: "123456", }, }); } else { Logspot.track({ event: "VideoUnmuted", metadata: { videoId: "123456", }, }); } });
There are many different parameters that you can track for video with Logspot, depending on your specific needs and the type of insights you are looking to gain. Some common parameters that you can track for video include:
videoId
: the unique identifier of the video that was playedvideoTitle
: the title of the video that was playedvideoLength
: the length of the video in seconds or minutesvideoCategory
: the category or genre of the videovideoLanguage
: the language of the videovideoCaption
: whether the video has captions or notvideoQuality
: the quality of the video (e.g. 1080p, 720p, etc.)videoFormat
: the format of the video (e.g. MP4, WebM, etc.)videoDevice
: the device on which the video was played (e.g. desktop, mobile, etc.)videoOperatingSystem
: the operating system on which the video was played (e.g. Windows, Mac, etc.)videoPlayer
: the player or platform on which the video was played (e.g. YouTube, Vimeo, etc.)videoSource
: the source of the video (e.g. uploaded, embedded, etc.)videoDuration
: the duration of the video in seconds or minutesvideoCurrentTime
: the current time of the video playbackvideoPaused
: whether the video is paused or notvideoMuted
: whether the video is muted or notvideoVolume
: the volume level of the video playbackvideoWidth
: the width of the video in pixelsvideoHeight
: the height of the video in pixelsvideoFullscreen
: whether the video is in fullscreen mode or notThese are just some examples of the different parameters that you can track for video with Logspot. You can track any parameters that are relevant to your web application and the insights you are looking to gain from your video tracking.
Video tracking is just one of many different use cases for Logspot. Logspot is a powerful product tracking tool that allows you to track and analyze a wide range of events and actions in your web application.
Start in under 2 minutes.
No credit card required.
Cancel anytime.
Subscribe to product updates
© Copyright 2023, All Rights Reserved by Logspot