Last updated: May-03-2023
You can register to a variety of video player events and then use these events to create custom video player controls or to trigger other custom behaviors in your application.
Additionally, many of these events can be tracked for Google Analytics or other analytics trackers.
Using video events
The video player supports standard HTML5 video player events as well as several specific Cloudinary video player events.
For example, you can define a set of percentages that will trigger the
percentsplayed event and then perform some operation when the player reaches any of those points. Below, the captured percentages are written to the console log:
Take a look at the Events sample on the Video Player demo page to see some of the events that are triggered as you perform operations on the video player.
For details on all available events, see Events in the Video Player API Reference.
Tracking video player analytics
You can track important data about how and when your customers are watching your videos by capturing relevant events. You can then pass this data to your Google Analytics account or other analytics trackers. The instructions below are specific to Google Analytics.
1. Activate analytics in your video player
You can either set the analytics parameter to
true, which monitors all available events except
percentplayed is monitored), or you can specify the specific events you want to monitor, including additional event sub-settings where relevant (
'percentsplayed', percents and
'timesplayed', times. See example below).
2. Include the Google Analytics code snippet in your page
Include the Google Analytics tracking snippet with your Google tracking ID near the top of the
<head> tag in your HTML page.
For details, see Google Analytics tracking snippet.
Cloudinary Video Analytics (Beta)
Video Analytics are currently in Beta and will be rolled out gradually to all customers. Some implementation details may change before the official release. If you would like to enable the Analytics earlier, you can contact our support team.
You can also view metrics on video content delivered through the Cloudinary Video Player from the Cloudinary console. Ensure you are using a version of the video player later than
1.9.8 to enable the data.
To access the reports, open the Reports sub-menu and select Video Analytics. Here, you will be presented with a set of metrics that show how your video content has been delivered, including:
- Player Loads: The number of times the Cloudinary Video Player has been loaded. This indicates user engagement and content visibility.
- Plays / Unique Views: The total number of video plays and individual users who have watched a video during a specific time period. This offers insights into content reach.
- Top Videos: The most popular videos based on the number of views. This helps identify your best-performing content.
- Top Devices / OS / Browsers / Countries: A set of graphs showing how your video content is consumed. This offers insights into the demographics of your users, and can be used to optimize the formats and sizes you use to deliver your videos.