• /
  • EnglishEspañolFrançais日本語한국어Português
  • 로그인지금 시작하기

Using Agent APIs

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

Agent initialization

Initialize the agent and control video session tracking

Lifecycle methods

Track application and scene lifecycle events

Event tracking

Send custom, system, and video events

HTTP monitoring

Monitor network requests and responses

Custom attributes

Add metadata to events for filtering and analysis

Logging

Send log messages to New Relic

Metrics

Track custom quantitative measurements

Harvest configuration

Control when data is sent to New Relic

Configuration

Update agent settings at runtime

Domain management

Configure domain substitution for URLs

User identification

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")
Copyright © 2026 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.