Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
gabek
Level 7

Using Segment.IO Analytics with your Roku app

When working on a new project I wanted to add the ability to track actions in the app. I decided to use Segment.IO since it's a middle man between you and many other different kind of analytics providers. If you want to simply add some analytics to your app you might want to give it a shot! Feel free to suggest changes.

https://github.com/gabek/SegmentIO-Brightscript
0 Kudos
4 Replies
uarlive
Level 7

Re: Using Segment.IO Analytics with your Roku app

Thanks for posting. Checking this out tonight.
0 Kudos
bdsearle
Level 7

Re: Using Segment.IO Analytics with your Roku app

I created my channel using the NewVideoExample by belltown - https://github.com/belltown/Roku-NewVideoPlayer.  I am trying to add your Segment.IO interface for event tracking to my channel today.  I have added the Analytics.brs to my source folder, but I don't quite understand what files to update or where to add the example code?
Code: Select all
User = createObject("roDeviceInfo").GetDeviceUniqueId()



Code: Select all
Analytics = Analytics("UserIdentifier", "SegmentIOAPIKey", YourEventLoopPort)



and
Code: Select all
MessagePort = GetGlobal().MessagePort
User = createObject("roDeviceInfo").GetDeviceUniqueId()
ApiKey = "ABCD1234"

Analytics = Analytics(User, ApiKey, MessagePort)

'My event loop
while true
    msg = wait(0,MessagePort)
    'You do stuff with events in your app here
    Analytics = GetSession().Analytics
    Analytics.HandleAnalyticsEvents(msg)
end while



also, in Segment, should I setup the profile as Android?
Thanks for your work creating this!
0 Kudos
belltown
Level 7

Re: Using Segment.IO Analytics with your Roku app

That library relies on the BrightScript application using a global event loop with a single message port shared by all UI components. NewVideoPlayer doesn't have a global event loop. Each UI component has its own port and message loop. Therefore you'd have to re-work the library to be able to integrate it with NewVideoPlayer.

Also, the library uses a geolocation API that no longer exists, http://www.telize.com/, so I'm not sure how useful the geolocation analytics would be to you.
https://github.com/belltown/
0 Kudos
bdsearle
Level 7

Re: Using Segment.IO Analytics with your Roku app

"belltown" wrote:
That library relies on the BrightScript application using a global event loop with a single message port shared by all UI components. NewVideoPlayer doesn't have a global event loop. Each UI component has its own port and message loop. Therefore you'd have to re-work the library to be able to integrate it with NewVideoPlayer.

Also, the library uses a geolocation API that no longer exists, http://www.telize.com/, so I'm not sure how useful the geolocation analytics would be to you.

Thanks for clearing that up for me, belltown!  Do you know of another analytics solution that would work with NewVideoPlayer?  I'm still in the learning process, so I'm hoping there is something else out there I can use that will tell me, at least, how many times each video on my channel is viewed.   Thanks again! ...and thanks for your work on NewVideoPlayer!
0 Kudos