The New Relic Roku agent provides a comprehensive API for monitoring system and video events in Roku applications. The API is organized into logical categories to help you quickly find the methods you need.
API categories
Browse API methods by category:
Category | Description |
|---|---|
Initialize the agent and control video session tracking | |
Track application and scene lifecycle events | |
Send custom, system, and video events | |
Monitor network requests and responses | |
Add metadata to events for filtering and analysis | |
Send log messages to New Relic | |
Track custom quantitative measurements | |
Control when data is sent to New Relic | |
Update agent settings at runtime | |
Configure domain substitution for URLs | |
Associate events with specific users |
Quick start guide
1. Initialize the agent
Start by initializing the New Relic agent in your Roku application:
sub Main(aa as Object) screen = CreateObject("roSGScreen") m.port = CreateObject("roMessagePort") screen.setMessagePort(m.port) scene = screen.CreateScene("VideoScene") screen.show()
m.nr = NewRelic("ACCOUNT ID", "API KEY")2. Start system logging
Enable system event monitoring:
m.syslog = NewRelicSystemStart(m.port)3. Track video sessions
Monitor video playback:
NewRelicVideoStop(m.nr)4. Send custom events
Track application events:
nrSendCustomEvent(m.nr, "MyEvent", "MY_ACTION")attr = {"key0":"val0", "key1":"val1"}nrSendCustomEvent(m.nr, "MyEvent", "MY_ACTION", attr)5. Add custom attributes
Add metadata to your events:
nrSetCustomAttribute(m.nr, "myNum", 123, "CONTENT_START")nrSetCustomAttribute(m.nr, "myString", "hello")6. Set user identifier
Associate events with specific users:
nrSetUserId(m.nr, "TEST_USER")