Skip to content

Roku Tracker v0.3.0 changes #1182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
383 changes: 361 additions & 22 deletions docs/reusable/media/_index.md

Large diffs are not rendered by default.

31 changes: 25 additions & 6 deletions docs/sources/trackers/roku-tracker/adding-data/index.md
Original file line number Diff line number Diff line change
@@ -59,20 +59,39 @@ Some subject information is filled automatically by the tracker. This includes t

The following table lists all the properties that can be set in tracker initialization. These are all part of the [Snowplow Tracker Protocol](/docs/sources/trackers/snowplow-tracker-protocol/index.md).

| Property | Description |
| --------------- | --------------------------------------- |
| `domainUserId` | Cookie-based unique identifier for user |
| `networkUserId` | Cookie-based unique identifier for user |
| `appId` | Unique identifier for application |
If not provided, from v0.3.0 onwards the `domainUserId` and `domainSessionId` will be generated by the tracker and stored in the app [Registry](https://developer.roku.com/en-au/docs/developer-program/getting-started/architecture/file-system.md).
This can be disabled by setting the `sessionContext` option to `false`.
By default, this information is attached via the `client_session` entity, similar to mobile platforms.
You can also include these values in the `domain_userid`, `domain_sessionid`, and `domain_sessionidx` fields by enabling the `sessionAsCookies` setting.

| Property | Description |
| -------------------- | ------------------------------------------ |
| `userId` | Unique user identifier in your system |
| `domainUserId` | Cookie-based unique identifier for user |
| `domainSessionId` | Cookie-based unique identifier for session |
| `networkUserId` | Cookie-based unique identifier for user |
| `appId` | Unique identifier for application |
| `applicationContext` | Enable an entity with the channel version |
| `sessionContext` | Whether to enable or disable session state |
| `sessionAsCookies` | Enable session identifiers in atomic fields|
| `userAnonymous` | Use a nil ID for the `domainUserId` value |
| `sessionAnonymous` | Use a nil ID for the `domainSessionId` value |

Example:

```brightscript
m.global.snowplow.init = {
subject: {
userId: "...",
domainUserId: "...",
domainSessionId: "...",
networkUserId: "...",
appId: "..."
appId: "...",
applicationContext: true,
sessionContext: false,
sessionAsCookies: true,
userAnonymous: true,
sessionAnonymous: true,
}
}
```
1 change: 1 addition & 0 deletions docs/sources/trackers/roku-tracker/configuration/index.md
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@ Properties of the network configuration:
| --- | --- |
| `collector` | URI for the Snowplow collector endpoint. |
| `method` | HTTP method to use. `GET` and `POST` methods are supported. |
| `serverAnonymous` | Enable the `SP-Anonymous` header for server anonymization. |

## Tracker namespaces

16 changes: 16 additions & 0 deletions docs/sources/trackers/roku-tracker/media-tracking/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: "Media tracking"
date: "2021-12-23"
sidebar_position: 4500
---

```mdx-code-block
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
```

Media tracking enables collecting events about audio/video playback from the [Audio](https://developer.roku.com/en-gb/docs/references/scenegraph/media-playback-nodes/audio.md) and [Video](https://developer.roku.com/en-gb/docs/references/scenegraph/media-playback-nodes/video.md) nodes provided in the Roku SceneGraph SDK for media playback.
Once enabled for a node, the tracker subscribes to selected events and tracks them automatically.
This makes adding media tracking into your Roku channels really simple.

There are [multiple versions](/docs/sources/trackers/javascript-trackers/web-tracker/tracking-events/media/index.md) of media tracking available, and the Roku tracker supports [v1](/docs/sources/trackers/roku-tracker/media-tracking/v1/index.md) and (from v0.3.0) [v2](/docs/sources/trackers/roku-tracker/media-tracking/v2/index.md).
Original file line number Diff line number Diff line change
@@ -1,33 +1,41 @@
---
title: "Video tracking"
title: "Media tracking (v1)"
date: "2021-12-23"
sidebar_position: 4500
---

Video tracking enables collecting events about video playback from the [Video node](https://developer.roku.com/en-gb/docs/references/scenegraph/media-playback-nodes/video.md) provided in the Roku SceneGraph SDK for media playback. Once enabled for a Video node, the tracker subscribes to selected events and tracks them automatically. This makes adding video tracking into your Roku channels really simple.
Media tracking has [multiple versions](/docs/sources/trackers/javascript-trackers/web-tracker/tracking-events/media/index.md) of schema available.
This document is for version 1 of the schemas, it is recommended to [migrate to v2 tracking](/docs/sources/trackers/roku-tracker/media-tracking/v2/index.md#migrating-from-v1).

## Usage

To start video tracking for a Video node, assign a `roAssociativeArray` with the video node to the `enableVideoTracking` property:
To start media tracking for an Audio/Video node, assign a `roAssociativeArray` with the node to the `enableVideoTracking` property:

```brightscript
m.global.snowplow.enableVideoTracking = {
label: "videoLabel", ' optional
video: m.Video
}
```

In addition to the video node, the `enableVideoTracking` property accepts several optional attributes listed in the table below.
From tracker version 0.3.0:
- You can also use `enableAudioTracking` and pass the node via `audio` instead of `video`
- The v2 `enableMediaTracking` call and `media` option will also work
- The tracker will use v1 tracking if the `version` option is not specified or defined as `1`.
- To opt into version 2 schemas (recommended), pass the `version: 2` option to your `enableMediaTracking` call.

In addition to the node and version selector, the `enableVideoTracking` property accepts several optional attributes listed in the tables below.

| Attribute | Type | Description | Required? |
| --- | --- | --- | --- |
| `video` | Video | Video node to be tracked | yes |
| `label` | String | An identifiable custom label sent with the event | no |
| `media` / `audio` / `video` | Audio / Video | Audio/Video node to be tracked | yes |
| `version` | Integer | Tracking schema version to use; defaults to 1 if not provided | no |
| `label` / `options.label` | String | An identifiable custom label sent with the event | no |
| `options.captureEvents` | String[] | Types of events to capture | no, defaults to all events except for `position` |
| `options.boundaries` | Integer[] | Percentage boundaries in playback for which events will be sent | no, defaults to `[10, 25, 50, 75]` |
| `options.positionInterval` | integer | Interval in seconds in which `position` events should be reported | no, defaults to 5 |
| `options.positionInterval` | Integer | Interval in seconds in which `position` events should be reported | no, defaults to 5 |
| `context` / `entities` | SelfDescribingJSON[] | Array of custom entities to include with all generated media events | no |

To stop tracking events from the video node, set the `disableVideoTracking` property. The tracker will then stop observing and tracking events from the video node. The property should be set with an `roAssociativeArray` with exactly one attribute, `video`, like so:
To stop tracking events from the node, set the `disableVideoTracking` property. The tracker will then stop observing and tracking events from the node.
The property should be set with an `roAssociativeArray` with exactly one attribute, `video` (or `audio`/`media`), like so:

```brightscript
m.global.snowplow.disableVideoTracking = {
@@ -37,6 +45,8 @@ m.global.snowplow.disableVideoTracking = {

## Media Player Events

### Media Events

All playback events are tracked automatically and conform to the `media_player_event` schema. The schema has two properties:

| Property | Description | Required? |
63 changes: 63 additions & 0 deletions docs/sources/trackers/roku-tracker/media-tracking/v2/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: "Media tracking (v2)"
date: "2025-03-21"
---

```mdx-code-block
import Media from "@site/docs/reusable/media/_index.md"
```

Media tracking has [multiple versions](/docs/sources/trackers/javascript-trackers/web-tracker/tracking-events/media/index.md) of schema available.
This document is for version 2 of the schemas; tracker versions earlier than v0.3.0 [only support v1 tracking](/docs/sources/trackers/roku-tracker/media-tracking/v1/index.md).


## Configuration

Most tracking of [Audio](https://developer.roku.com/en-au/docs/references/scenegraph/media-playback-nodes/audio.md) and [Video](https://developer.roku.com/en-au/docs/references/scenegraph/media-playback-nodes/video.md) nodes is automatic, so configuration is minimal.

For backwards compatibility with [v1 media tracking](/docs/sources/trackers/roku-tracker/media-tracking/v1/index.md), most options will accept either `roAssociativeArray` format in the `enableMediaTracking` call as long as `version` is specified as `2`.

The accepted options include:

| Attribute | Type | Description | Required? |
| --- | --- | --- | --- |
| `media` / `audio` / `video` | Audio / Video | Audio/Video node to be tracked | yes |
| `version` | Integer | Tracking schema version to use; should be set to 2 | yes |
| `id` | UUID | A unique ID to use for the media `session` entity to group all tracked events | no; generated by tracker if not provided |
| `label` / `options.label` | String | An identifiable custom label sent with the event in the `media_player` entity | no |
| `sessions` | boolean | Whether to attach the media `session` entity on tracked events | no; defaults to `true` |
| `pings` | boolean | Whether to periodically generate media `ping_event`s while content is playing | no; defaults to `true` |
| `pingInterval` / `options.positionInterval` | Integer | Interval in seconds in which `ping_event`s should be reported | no, defaults to `30` seconds |
| `boundaries` / `options.boundaries` | Integer[] | Percentage boundaries in playback for which `percentage_progress_event`s will be sent | no, defaults to `[25, 50, 75]` |
| `captureEvents` / `options.captureEvents` | String[] | Types of events to capture. If specified, the event names should not have the `_event` suffix | no, defaults to all events |
| `context` / `entities` | SelfDescribingJSON[] | Array of custom entities to include with all generated events | no |

## Migrating from v1

If you are migrating from the v1 tracking, v2 has compatibility options to make the change easier.

For backwards compatibility with the earlier tracking API, you can use `enableVideoTracking` instead of `enableMediaTracking`, and pass the node via the `video` option instead of `media`.
For symmetry, `enableAudioTracking` and `audio` will work as well; the tracking will work with any combination of these method and option names regardless of node type, as long as `version: 2` is specified.
You can also specifically opt into version 1 by passing `version: 1`.

The additional options differ by version; but version 2 will accept the options from version 1 if it can't find the newer equivalent settings.

| v2 Attribute | v1 Fallback | Type | Description |
| --- | --- | --- | --- |
| `media` / `audio` / `video` | `media` / `audio` / `video` | Audio / Video | Audio/Video node to be tracked |
| `version` | `version` | Integer | Tracking schema version to use; should be set to 2 |
| `id` | N/A | UUID | A unique ID to use for the media `session` entity to group all tracked events |
| `label` | `options.label` | String | An identifiable custom label sent with the event in the `media_player` entity |
| `sessions` | Default enabled | boolean | Whether to attach the media `session` entity on tracked events |
| `pings` | Default enabled | boolean | Whether to periodically generate media `ping_event`s while content is playing |
| `pingInterval` | `options.positionInterval` | Integer | Interval in seconds in which `ping_event`s should be reported |
| `boundaries` | `options.boundaries` | Integer[] | Percentage boundaries in playback for which `percentage_progress_event`s will be sent |
| `captureEvents` | `options.captureEvents` | String[] | Types of events to capture. If specified, the event names should not have the `_event` suffix |
| `context` / `entities` | `context` | SelfDescribingJSON[] | Array of custom entities to include with all generated events |


## Media Player Events

```mdx-code-block
<Media tracker="roku" />
```
2 changes: 1 addition & 1 deletion src/componentVersions.js
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ export const versions = {
phpTracker: '0.8.0',
pixelTracker: '0.3.0',
pythonTracker: '1.0.3',
rokuTracker: '0.2.0',
rokuTracker: '0.3.0',
rubyTracker: '0.8.0',
rustTracker: '0.2.0',
scalaTracker: '2.0.0',
2 changes: 2 additions & 0 deletions static/_redirects
Original file line number Diff line number Diff line change
@@ -167,6 +167,8 @@ docs/understanding-tracking-design/managing-data-structures-with-data-structures
/docs/getting-started-on-snowplow-open-source/quick-start-gcp/summary-of-what-you-have-deployed/ /docs/getting-started-on-snowplow-open-source/what-is-deployed/ 301
/docs/getting-started-on-snowplow-open-source/quick-start-aws/upgrade-guide/ /docs/getting-started-on-snowplow-open-source/upgrade-guide/ 301

/docs/sources/trackers/roku-tracker/video-tracking/ /docs/sources/trackers/roku-tracker/media-tracking/ 301

# Combining JS tracker docs
/docs/collecting-data/collecting-from-own-applications/javascript-trackers/browser-tracker/quick-start-guide/ /docs/collecting-data/collecting-from-own-applications/javascript-trackers/web-tracker/quick-start-guide/ 301
/docs/collecting-data/collecting-from-own-applications/javascript-trackers/browser-tracker/cookies-and-local-storage/ /docs/collecting-data/collecting-from-own-applications/javascript-trackers/web-tracker/cookies-and-local-storage/ 301