1. Home
  2. Blog
  3. Releases
Engineering, Releases

Introducing new media tracking SDKs

We are excited to announce a new version of our SDKs for tracking video playback on the web and now also on mobile apps. With this release, we provide a major update that brings new features and improvements to our media tracking capabilities.

Example of a media tracking scenario. It illustrates tracked events and tracker calls during a media playback. First, the video player appears, resulting in a ready event tracked. The play event is tracked when the user hits play. During ad playback, multiple ad events are tracked. Finally, the video is resumed after the ad and completes video playback with the end event. Throughout the playback, ping events are periodically tracked.

We have created a simple demo app that showcases the tracked media events and their properties. It is available here. The demo app shows how our media tracking plugin works and what media events it tracks

Key features

The new Snowplow media SDKs provide universal media tracking APIs, a new media session entity with playback stats, support for live video tracking, ad tracking during playback, and customizable tracking for mobile apps.

Universal media tracking APIs

One of the most important new features of our media tracking plugin is the ability to integrate with any media player. Instead of integrating with a specific media player ( e.g., YouTube or Bitmovin), the plugin provides universal media tracking APIs that can be used to track media events regardless of the media player used. This allows developers to integrate and use our media tracking plugin with a variety of media players.

New media session entity with playback stats

The plugin adds a new media session context entity to tracked events that identifies media playback. The entity also adds statistics calculated using edge analytics on the tracker, such as the time spent playing, buffering, or the number of ads played. This allows developers to track the progress of media playback more accurately and in more detail.

The context entity has properties such as contentWatched to track the total seconds of content played. It has adsClicked to track the number of ads clicked. Other properties include timeSpentAds, adBreaks, timeBuffering, timePaused and timePlayed for more detailed tracking.

Live video tracking support

With the addition of media ping events, the plugin now supports regular tracking of progress within a live streamed video. The media ping events are fired periodically when the media is played with configurable frequency and settings. In addition, the plugin ensures that page ping events are tracked during playback, even when the user is not interacting with the page. With this feature, developers can now more accurately track the progress of live streamed videos.

Tracking ads during playback

The plugin provides out-of-the-box events and entities for tracking ads within linear, non-linear, and companion ad breaks during playback. This makes it easier for developers to track how ads are viewed and optimize their ad campaigns accordingly. For example, developers can use this feature to track how many users clicked on an ad or how long a user viewed an ad.

New event schemes, customizable tracking and mobile app support

Additionally, the media tracking plugin offers new event schemas with more properties for easier data analysis (see here). Custom media events and entities can be tracked with the media package to meet specific requirements. The media SDKs are also available on iOS and Android trackers, which have the same features as media tracking on the web trackers.

Using the tracking SDKs

The Snowplow media SDKs have been available as a plugin for the JavaScript tracker since version 3.12. They are also part of the iOS and Android trackers starting from version 5.3. You can read the documentation for the JavaScript tracker here. The documentation for the mobile trackers can be found here. The following snippet shows an example of using the media plugin in the JavaScript tracker.

newTracker("ns1", "https://...", { plugins: [SnowplowMediaPlugin()] });
const id = "playback-id"; // Unique identifier for the playback

// Initialize the media tracking identified by the `id`. It will start tracking media ping events.
startMediaTracking({ id, player: { duration: 100 } });
// Track a media play event within the media tracking.
trackMediaPlay({ id });
// Update the current playback position without tracking any events.
updateMediaTracking({ id, player: { currentTime: 50 } });
// Track the start of an ad.
trackMediaAdStart({ id, ad: { adId: "ad-id", name: "Ad 1" duration: 4 } });
// End and clear the state for the media tracking.
endMediaTracking({ id });

This is a simplified example usage of the media plugin for the the browser tracker that manages tracking for a media playback and tracks a couple of events.

In summary, with our new media tracking capabilities, developers now have access to a more comprehensive and accurate way of tracking media playback across a variety of platforms and media players. Our plugin offers a number of features and customizations that allow developers to track media events in real-time and with more detail. We are actively working to update our dbt media data models to work with the new event and entity schemas. If you have any feedback, we would love to hear from you on Discourse!

More about
the author

Matúš Tomlein
Matúš Tomlein

Matus is a software engineer in the Snowplow tracker SDKs team. He has worked on various trackers including the JavaScript, mobile, and C++ trackers.

View author

Unlock the value of your behavioral data with customer data infrastructure for AI, advanced analytics, and personalized experiences

Image of the Snowplow app UI