PAL SDK Roku API Reference

Stay organized with collections Save and categorize content based on your preferences.
    1. ima
    2. ima.NonceLoader
    3. ima.NonceManager
    4. ima.NonceRequest

Class ima

Global functions that control Roku IMA for PAL.

Back to top

Class ima.NonceLoader


The programmatic access library allows publishers to collect signals that can be used to unlock AdX demand. For each ad request, call the relevant setters as needed followed by a call to loadNonceManager. Publishers can then call NonceManager.getNonce() in order to get the string that should be added to ad requests as the value to the


Returns ima.NonceLoader:


Returns ima.NonceManager: A nonce manager for generating a nonce for an ad request.

Parameter Type Description
request ima.NonceRequest

The request containing information about the nonce being requested.

Back to top

Class ima.NonceManager


Manages a nonce and its event reporting for a single content playback session. The content playback session lifecycle methods, including ima.NonceManager.sendAdClick, ima.NonceManager.sendAdTouch, ima.NonceManager.sendPlaybackStart, and sendPlaybackEnd must be called as these respective events occur in order to enable programmatic monetization.


Returns String: The nonce generated for this manager when it was loaded. This value will never change for a given NonceManager instance. This nonce value is only valid for a single content playback session up to a maximum duration of 6 hours.


Updates the manager state so that it can keep track of playback progress.


Notifies Google ad servers that a clickthrough on an ad has occurred during the given content playback session.


Deprecated. Use ima.NonceManager.sendPlaybackStart and ima.NonceManager.sendPlaybackEnd/code>.


Notifies Google ad servers that a user touch or click on the ad other than a clickthrough (for example, skip, mute, tap, etc.) has occurred during the given content playback session.

Parameter Type Description
touch roInputEvent|String

The key received from onKeyEvent (if using SceneGraph), or the roInputEvent otherwise.


Notifies Google ad servers that playback for the given content playback session has ended. This should be called when playback ends (for example, when the player reaches end of stream, or when the user exits playback mid-way, or when the user quits the channel, or when advancing to the next content item in a playlist setting). This method ends the asynchronous calls to Google servers started in sendPlaybackStart.


Notifies Google ad servers that playback for the given content playback session has started. This should be called on "video player start". This may be in response to a user-initiated action (click-to-play) or a channel initiated action (autoplay). This method will start asynchronous calls to Google servers to collect signal needed for IVT monitoring and detection.

Back to top

Class ima.NonceRequest



Information a publisher can provide when requesting a PAL nonce.


Name Type Description

Set to true if the ad will be auto played without waiting for user interaction. Set to false if the ad will wait for user interaction before being played.


Set to true if the ad will be played while muted. Set to false if the ad will play unmuted.


Set to true if the player intends to continuously play the content videos one after another similar to TV broadcast or video playlist. Set to false otherwise.


The description URL of the content during which the ad will be played. Any description URL string longer than 500 characters will be ignored and excluded from the nonce.


Whether the ad request is directed to a child or user of an unknown age (TFCD or TFUA). Default value is false.


Whether VAST icons are supported by the video player. On Roku this value should always be false.


The publisher provided ID. Any PPID longer than 200 characters will be ignored. Note: The PPID will not be used in personalisation. If it is appropriate to use a ppid for personalization, include it separately in clear text in your ad request.


Session ID is a temporary random ID. It is used exclusively for frequency capping. A session ID must be a UUID.


Whether storage consent (purpose 1 consent) from the IAB TCF V2 spec has been granted by the user. Defaults to true.


Accepts an array of strings representing API framweworks supported by the player as defined in AdCOM 1.0 "API Frameworks" list Example: ["2","7","9"] indicates this player supports VPAID 2.0, OMID 1.0, and SIMID 1.1.


The height of the ad video element.


The width of the ad video element.


Returns ima.NonceRequest:

Back to top