- Login to Datazoom here: https://app.datazoom.io
- Add a Collector as indicated here: How to add a Collector
- Copy the
config key
that was created at the end of the process
Click the icon indicated below to copy the Configuration Key
You will see this message:
4. Replace the <configuration id from Datazoom>
with the Key you copied above.
5. Replace the <url given by Datazoom>
with <https://platform.datazoom.io/beacon/v1/>
Adding dependencies to your project
Roku Plugin for Eclipse IDE
For Roku plugin installation and usage in Eclipse IDE
https://sdkdocs.roku.com/display/sdkdoc/Roku+Plugin+for+Eclipse+IDE
Installation Instructions
Clone the repository
git clone https://gitlab.com/datazoom/roku/roku-collector-libraries-release.git
Extract the components folder from cloned repository(Latest version)
Copy the components folder in your channel project.
Note: We assume that:
- The developer had already created a Roku project(in Eclipse IDE).
- The project does not have components folder. If there is already a components folder, then copy the content of the components directory(DzLib folder) into your project's components directory
eg: /<your project>/components/DzLib - This project contains the base and native-collector library(inside DzLib folder).
Configuring collector library in channel
Copy the following in MainScene.brs(in components folder) or in the brs file you intend to configure the collector library.
In Sub/function init(), add the following
m.player = m.top.findNode("<Player ID>") m.DzLib = m.top.findNode("DzLib") DzCollector()
Also add the following function for initializing SDK
Sub DzCollector() m.DzLib.libConfiguration = { configURL : "<url given by Datazoom>", configId: "<configuration id from Datazoom>" } m.DzLib.initiateCollector = true End Sub
DzCollector() will call the above function when initialized.
Note:
Change the configURL, configId and <Player ID> as per the requirement.
Copy the following inside <children> in MainScene.xml or in the xml file you intend to configure the collector library.
<DzLib id="DzLib" />
Note:
At this point Datazoom SDK is initialized and we can send custom events and metadata, user data, device data and geo location data.
We can set Custom Metadata to Datazoom SDK using following methods:
m.DzLib.callFunc("setDatazoomMetadata","CustomMetaKey1", "CustomMetaValue1")
or
m.DzLib.callFunc("setDatazoomMetadata",{customMetaKeyDict1 : "CustomMetaValueDict1", customMetaKeyDict2 : "CustomMetaValueDict2", customMetaKeyDictNth : "CustomMetaValueDictNth" })
Change "CustomMetaKey" and "CustomMetaValue" to any text or variable you want to send to collector service
We can also delete Custom Metadata by sending empty string
m.DzLib.callFunc("setDatazoomMetadata","CustomMetaKey1", "")
Also we can send Custom Event to Datazoom SDK using following methods:
m.DzLib.callFunc("generateDatazoomEvent","SOME CUSTOM EVENT")
We can also add some custom metadata to generated custom event
m.DzLib.callFunc("generateDatazoomEvent", "SOME CUSTOM EVENT", {customEventMetaKeyDict1 : "CustomEventMetaValueDict1", customEvemtMetaKeyDict2 : "CustomEventMetaValueDict2", customEventMetaKeyDictNth : "CustomEventMetaValueDictNth"})
Now, after we create player instance we can add player to Datazoom SDK
Add the following inside <children> in MainScene.xml or in the xml file you intend to configure the collector library.
<Video id="<Player ID>" />
and your xml file should look like this:
<children> <DzLib id="DzLib" /> <Video id="<Player ID>" /> </children>
Note:
Change <Player ID> as per the requirement.
Now add the following function for initializing player to Datazoom SDK:
Sub DzPlayer() m.DzLib.playerInit = { player: m.video } m.DzLib.initiatePlayer = true ' m.DzLib.initiateCollector = true End Sub
DzPlayer() will call the above function when initialized.
Note:
At this point Datazoom SDK is fully initialized with player. Selected data points will be collected from player and sent to collector service.
Instructions to create a compiled zip file
- Your-Project(Right click) > Export > BrightScript > BrightScript Deployment >[Change File name/path, if needed (.zip)] > Finish
- Open browser and go to Roku's local network IP address.(eg: 192.168.0.9). Provide username and password of developer mode.
- Click upload and select the newly created zip file. Click install.
- The channel will automatically start playing. This channel can also be played by-> go to Roku menu, select the Roku developer channel and play.
- To view the data points generated by Roku, go to Linux terminal and type
telnet <Roku's Local IP> 8085
eg: - telnet 192.168.0.9 8085
Reference: https://sdkdocs.roku.com/display/sdkdoc/Debugging+Your+Application
Comments
0 comments
Article is closed for comments.