This page describes how to instrument your applications for both Real User Monitoring (RUM) and Error Tracking with the Roku SDK. You can follow the steps below to instrument your applications for RUM (includes Error Tracking) or Error Tracking if you have purchased it as a standalone product.
The Datadog Roku SDK supports BrightScript channels for Roku OS 10 and higher.
ROPM is a package manager for the Roku platform (based on NPM). If you’re not already using ROPM in your Roku project, read their Getting started guide. Once your project is set up to use ROPM, you can use the following command to install the Datadog dependency:
If your project does not use ROPM, install the library manually by downloading the Roku SDK zip archive
and unzipping it in your project’s root folder.
Make sure you have a roku_modules/datadogroku subfolder in both the components and source folders of your project.
Select Roku as the application type and enter an application name to generate a unique Datadog application ID and client token.
To disable automatic user data collection for client IP or geolocation data, uncheck the boxes for those settings. For more information, see Roku Data Collected.
Select Roku as the application type and enter an application name to generate a unique Datadog application ID and client token.
To disable automatic user data collection for client IP or geolocation data, uncheck the boxes for those settings. For more information, see Roku Data Collected.
To ensure the safety of your data, you must use a client token. If you use only Datadog API keys to configure the dd-sdk-roku library, they are exposed client-side in the Roku channel’s BrightScript code.
In the initialization snippet, set an environment name. For more information, see Using Tags.
sub RunUserInterface(args as dynamic)
screen = CreateObject("roSGScreen")
scene = screen.CreateScene("MyScene")
screen.show()
datadogroku_initialize({
clientToken: "<CLIENT_TOKEN>",
applicationId: "<APPLICATION_ID>"
site: "us1",
env: "<ENV_NAME>",
sessionSampleRate: 100, ' the percentage (integer) of sessions to track
launchArgs: args
})
' complete your channel setup here
end sub
sub RunUserInterface(args as dynamic)
screen = CreateObject("roSGScreen")
scene = screen.CreateScene("MyScene")
screen.show()
datadogroku_initialize({
clientToken: "<CLIENT_TOKEN>",
applicationId: "<APPLICATION_ID>"
site: "eu1",
env: "<ENV_NAME>",
sessionSampleRate: 100, ' the percentage (integer) of sessions to track
launchArgs: args
})
' complete your channel setup here
end sub
sub RunUserInterface(args as dynamic)
screen = CreateObject("roSGScreen")
scene = screen.CreateScene("MyScene")
screen.show()
datadogroku_initialize({
clientToken: "<CLIENT_TOKEN>",
applicationId: "<APPLICATION_ID>"
site: "us3",
env: "<ENV_NAME>",
sessionSampleRate: 100, ' the percentage (integer) of sessions to track
launchArgs: args
})
' complete your channel setup here
end sub
sub RunUserInterface(args as dynamic)
screen = CreateObject("roSGScreen")
scene = screen.CreateScene("MyScene")
screen.show()
datadogroku_initialize({
clientToken: "<CLIENT_TOKEN>",
applicationId: "<APPLICATION_ID>"
site: "us5",
env: "<ENV_NAME>",
sessionSampleRate: 100, ' the percentage (integer) of sessions to track
launchArgs: args
})
' complete your channel setup here
end sub
sub RunUserInterface(args as dynamic)
screen = CreateObject("roSGScreen")
scene = screen.CreateScene("MyScene")
screen.show()
datadogroku_initialize({
clientToken: "<CLIENT_TOKEN>",
applicationId: "<APPLICATION_ID>"
site: "ap1",
env: "<ENV_NAME>",
sessionSampleRate: 100, ' the percentage (integer) of sessions to track
launchArgs: args
})
' complete your channel setup here
end sub
Configuring the session sample rate does not apply to Error Tracking.
To control the data your application sends to Datadog RUM, you can specify a sampling rate for RUM sessions while initializing the RUM Roku SDK. The rate is a percentage between 0 and 100. By default, sessionSamplingRate is set to 100 (keep all sessions).
See Track RUM Resources to enable automatic tracking of all your resources, and Enrich user sessions to add custom global or user information to your events.
To split user sessions into logical steps, manually start a View using the following code. Every navigation to a new screen within your channel should correspond to a new View.
RUM Actions represent the interactions your users have with your channel. You can forward actions to Datadog as follows:
targetName = "playButton" ' the name of the SG Node the user interacted with
actionType = "click" ' the type of interaction, should be one of "click", "back", or "custom"
m.global.datadogRumAgent.callfunc("addAction", { target: targetName, type: actionType})
RUM ensures availability of data when your user device is offline. In case of low-network areas, or when the device battery is too low, all the RUM events are first stored on the local device in batches.
Each batch follows the intake specification. They are sent as soon as the network is available, and the battery is high enough to ensure the Datadog SDK does not impact the end user’s experience. If the network is not available while your application is in the foreground, or if an upload of data fails, the batch is kept until it can be sent successfully.
This means that even if users open your application while offline, no data is lost. To ensure the SDK does not use too much disk space, the data on the disk is automatically discarded if it gets too old.