Snowplow tracker for Roku with video tracking


We are pleased to announce the release of our tracker for Roku devices, now in version 0.2.0. This tracker enables Roku developers collect rich behavioral data from their Roku channels.
The new Roku tracker already comes with a sizable feature set. It enables tracking common event types (self-describing, structured, and screen view) along with custom context entities. It automatically enriches each event with context information about the Roku device, unique identifiers for channel and device, current device usage, and more. However, perhaps the most exciting feature offered by the Roku tracker is video tracking.
Video tracking
Support for video tracking is built into the Roku tracker. It integrates with the Video node provided in the Roku SceneGraph SDK for media playback. When enabled for a Video node, the tracker subscribes to and tracks relevant events. This makes adding video tracking into your Roku channels really simple.
To illustrate, the following code starts video tracking for a Video node referred to as m.Video
:
m.global.snowplow.enableVideoTracking = {
video: m.Video
}
There are additional configuration options that can be passed to the enableVideoTracking
property to configure which events to track and how. Please refer to the documentation for a complete overview.
The video tracking can be disabled at the end of video playback in a similar fashion:
m.global.snowplow.disableVideoTracking = {
video: m.Video
}
Video events tracked by the tracker notify of changes in playback position and playback state. There are two types of playback position events: ones that are sent when the playback reaches predefined percentage boundaries (e.g., 25% of playback), and ones that are sent whenever the playback moves by certain number of seconds (suitable for live video). State change events notify when playback is started, paused, finished, buffering, or when an error in playback occurs.
All events follow well-crafted Snowplow schemas. Media player event schema is used for payload of the self-describing events. Moreover, each event contains 2 context entities: media player context entity, and a Roku-specific video context entity. These schemas give a full picture of the video playback including information on the current position, bitrate, playback settings, and more. As we add wider support for video tracking across our trackers, we will use the same media player schemas. Stay tuned for more, exciting news to follow in this space.
Using the tracker
The Snowplow tracker uses the latest stack for development of SceneGraph applications. It is written in BrighterScript and uses the Roku package manager (ropm) for distribution. Nevertheless, it can be easily integrated into any SceneGraph application written in BrightScript using the packaged releases. Visit the getting started section of the documentation to learn how to install the tracker in your Roku channel.
When installed, the tracker needs to be instantiated and added to global application scope. In this way, it will be accessible from anywhere within your SceneGraph application. You may create the instance in the init
function of your main scene:
m.global.AddField("snowplow", "node", false)
m.global.snowplow = CreateObject("roSGNode", "Snowplow")
Trackers are initialized by setting the init
property with configuration of the tracker. This configuration takes the form of a roAssociativeArray
. At its most basic, the configuration takes a Snowplow collector endpoint like so:
m.global.snowplow.init = {
network: {
collector: "http://..."
}
}
To track an event, simply assign its properties as a roAssociativeArray
to a field corresponding to the event type (i.e., screenView
, selfDescribing
, structured
). To track a structured event, assign the structured
property:
m.global.snowplow.structured = {
se_ca: "category",
se_ac: "action",
se_la: "label",
se_pr: "property",
se_va: 10
}
We are very keen to hear your feedback to shape the future releases of this tracker! Please feel free to open discourse topics with ideas, and add issues and bug reports to the repo. We also welcome contributions and PRs. If in doubt, open an issue or a discourse post to ask about your contribution.