Source code: statsig-io/roku-sdk
Setup the SDK
1
Install the SDK
You can start by downloading a copy of the GitHub repository. Roku does not have a package manager where we could release an SDK, so instead, you will copy over the implementation from this repository to integrate Statsig in your Roku app.You will need the following files:The library consists of two main parts:
- source/Statsig - an object used by SceneGraph components that connects a StatsigClient with the background StatsigTask.
- components/StatsigTask - a SceneGraph Task to do work in the background for integrating with Statsig like batching events and fetching values from Statsig servers.
StatsigTask.xml. You will also need to include those references in your main XML file.2
Initialize the SDK
Next, initialize the SDK with a client SDK key from the “API Keys” tab on the Statsig console. These keys are safe to embed in a client application.Along with the key, pass in a User Object with the attributes you’d like to target later on in a gate or experiment.To Initialize the SDK, you first need to integrate the SDK files into your application.Include If you need to update the user,
StatsigClient.brs, StatsigUser.brs, DynamicConfig.brs, and Statsig.brs:m.statsig.updateUser(newUser) will trigger the same onStatsigReady callback once the new gate/config/experiment values have been fetched from Statsig servers.