- Getting Started
- Use Cases
- Client Side Ad Insertion
- Enabling Nielsen Digital Ad Ratings
- Frequency Capping and Targeting using RIDA
- Custom Buffering Screens
- Custom Ad Parsing and Rendering
- Requirements for Server Side Ad Insertion
- Testing your RAF Implementation
- API Reference
- setAdUrl(url as String)
- getAdUrl() as String
- setContentGenre(genres as String, kidsContent as Boolean)
- setContentId(id as String)
- setContentLength(length as Integer)
- setAdPrefs(useRokuAdsAsFallback as Boolean, maxRequests as Integer)
- setAdConstraints(maxHeight as Integer, maxWidth as Integer, maxBitrate as Integer, supportedMimeTypes as Object)
- setAdBreaks(contentLength as Integer, adBreakTimes as Integer)
- importAds(adPodArray as Object)
- enableJITPods(enabled as Boolean)
- setTrackingCallback(callback as Function, obj as Object)
- setDebugOutput(enabled as Boolean)
- getLibVersion() as String
- Nielsen DAR
- Nielsen DCR
- General Audience Measurement
- Server-Stitched Ads
- Buffer Screen Customization
- setAdBufferScreenContent(contentMetaData as Object)
- enableAdBufferMessaging(enableMsg as Boolean, enableProgressBar as Boolean)
- setAdBufferScreenLayer(zOrder as Integer, contentMetaData as Object)
- setAdBufferRenderCallback(callback as Function, obj as Object, timeout as Integer)
- URL Parameter Macros
- Ad Structure
- Roku Genre Tags
- Nielsen DAR Genre Tags
The RAF library is intended to allow developers to focus their effort on the core design of their applications, and provide them with the ability to quickly and easily integrate video advertising features with minimal impact to the rest of their application. This section provides an overview of the fundamental steps required to integrate with such applications. Other developers may wish to have more control over certain features within their applications, such as rendering the ads with a custom UI, or integrating the event tracking with a 3rd-party analytics API. The API Reference provides more detailed information on the video ad API, and the Use Cases section offers examples designed to cover a variety of different scenarios. The video ad features are provided as a common library deployed and managed as a hidden channel.
The following line must be placed in the manifest file for any applications using the Roku Ad Framework library:
Client applications do not include any additional BrightScript modules as part of their own channel package. Instead, the “Library” keyword is used. The following line should be the first entry in your
The library interface is obtained by calling the constructor with no arguments:
If the client application is using Roku’s default ad server to fill ads, no other configuration is required. Otherwise, configure the ad URL before making the ad request call:
Aside from the Configuration interface, there are two main methods used to control ad parsing and rendering. The first, getAds(), makes the initial request to the ad server, parses the server response, and returns the structure of ads to be rendered prior to, or during playback, of the selected content:
Any preroll ads present in the returned set of ad pods can be immediately rendered by calling:
Checking and acting on the return value here allows the application to determine if the user exited out of the ad (for example, by pressing the “Back” button on the remote) and return to the content selection screen before playing the main content.
If the application is only showing preroll ads, the above five lines are sufficient. If the ad server URL was configured for additional midroll and/or postroll ads, the client application should periodically call getAds() with the message from the content video playback loop to determine when to halt the content playback and render the ads:
Please note that the system overlay behavior has been modified in Roku OS 8. Every time RAF is rendered, the Video node will not be in focus. For the Roku system overlay to slide out when the * button is clicked, the Video node should be set to be in focus. Otherwise, the channel retains control over the * button and will need to handle button presses on their own. To set the Video node in focus again, use the following code snippet:
The video ad library is intended to support a variety of use cases, depending on the requirements of the application. The sample code presented here is provided for illustrative purposes of each of these cases and is not intended to represent required or optimal usage in client applications. For clarity and concision, error and object validity checking are omitted in these examples.
In all cases, the library must first be included and its interface constructed as described in Getting Started. Additionally, unless the client application is using Roku’s default ad URL (which currently provides only a single ad), the ad URL must be configured before requesting an ad pod:
At this point, the ad server response has been fully parsed and is available in the adPods Ad Structure.
Client Side Ad Insertion
If the client application has no need for custom UI or user interaction during ad rendering, it is recommended to use the default rendering method showAds(). This method handles rendering and control of interactive and video ads, as well as displaying basic messaging UI (e.g., “Your program will continue after these messages”) and feedback UI (“Ad 1 of 3”). Calling showAds() with an array of ad pods (such as the structure returned from the initial call to getAds()) will render the first pod scheduled as a preroll. Calling it with a single ad pod will render that pod, regardless of its
Single Preroll Ad Pod
Just call showAds() with the adPods value that the application obtained above:
Note that the return value should still be checked to see if the user exited the ad, and therefore should also exit out of content playback back to a selection screen.
Typically, if the ad service URL is configured to return a slate of ad pods to be presented throughout the presentation of the content, it is sufficient to use getAds() as an event listener in the content video event loop, as described in Getting Started, to determine when the scheduled ad breaks should occur:
This usage of getAds() also automatically implements the default policy that determines whether to re-render ads that have already been viewed. This policy permits the user to rewind content up to 5 minutes before a scheduled ad break before displaying that ad pod again.
Alternatively, there may be instances where the application must have greater control over when ad breaks occur. As an example, if the ad service is configured to return a VAST 2.0 response without temporal ad breaks, the application could re-interpret this unstructured response and schedule rendering of those ads as necessary:
Default sequential rendering could then be used by first importing this new
scheduledPods ad structure, as described in Custom Ad Parsing and Rendering.
Or, if the library’s ad rendering features are desired without the default ad scheduling mechanism, the application may completely control which ads are scheduled for rendering:
This type of custom ad scheduling may also be necessary if the client application relies on multiple ad services to fill its ad slots. For this case, separate calls are made to setAdUrl(), followed by getAds(), to get the ads from each service. Then scheduling and rendering can be done using one of the methods described above.
For an example, see: FullRAFSceneGraphSample.zip
Enabling Nielsen Digital Ad Ratings
As third parties such as Nielsen measure all video advertising in the digital ecosystem, Roku mandates that all channels enable Nielsen DAR in their Roku apps. Even if the publisher does not have a direct relationship with Nielsen, it is important to enable that in the app so as to avoid an app update when/if there is a decision made to enable Nielsen.
Nielsen DAR must first be enabled using:
This need only be done once and can be called at any point before any ads are rendered.
Next, a Nielsen application ID must be set for accurate campaign measurement. If you are not working with Nielsen directly, you can use Roku's default App Id:
Each content item will then need to be tagged appropriately. The required attributes are:
- title (NielsenProgramId) - this value should the title of a movie or series and should not uniquely identify episodic content
- length of the content (in seconds)
- Nielsen genre (see Nielsen DAR Genre Tags)
The content-specific metadata should be set when new content is selected before any ads are rendered, so that the values can be added to the custom Nielsen impression tags for the ads. If any of these metadata are unknown for a particular piece of content (for example, live streams may not have a specific content length), applications should call the appropriate function with an empty parameter to clear the value.
Frequency Capping and Targeting using RIDA
The Roku ID for Advertising is a device identifier available to Roku publishers for development and marketing purposes. It is designed to generally follow the guidelines established for the IDFA (Identifier for Advertising) used on other platforms. The RIDA limits disclosure of users’ identifying information and allows the ability to opt-out of remarketing or reset the ID at any time. It is the ID that Roku offers to its publishers to enable frequency capping and targeted advertising on the Roku platform.
The app can use the GetRIDA() API to get the RIDA for the device. RIDA should only be passed for audience targeting if "Limit Ad Tracking" is not set in the Roku Settings UI. If the RIDA is not set, it should still be used for frequency capping and when the ad server may need to know the user state. The app can check that by calling the IsRIDADisabled() API.
RIDA Specific Parameters
Many leading ad servers such as FreeWheel and DFP have Roku specific parameters in their ad request that the app can pass the RIDA in.
For Freewheel, the parameters are:
For DFP, the parameter is called
rdid. Additional details available here: https://support.google.com/dfp_premium/answer/6238701?hl=en
Replace <roku-device-id> with the RIDA for audience targeting.
Custom Buffering Screens
RAF also supports multiple ways of customizing the buffering screen which appear before ad playback.
Default Ad Buffering Screen
The default ad buffering screen displays a message and a progress bar. Both attributes can either be enabled or disabled using enableAdBufferMessaging().
Custom Buffering Screen Using Content Meta-data (Fixed Positioning)
The buffering screen can also be customized by passing a Content meta-data object to setAdBufferScreenContent(). This function does not support custom positioning. Instead, use SetAdBufferScreenLayer() as described in the next section.
The supported content meta-data attributes are:
|Attribute||Positioning||Example (below image)|
|HDBackgroundImageUrl||Aligned to top-left corner||https://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Aspect-ratio-16x9.svg/1280px-Aspect-ratio-16x9.svg.png|
|SDBackgroundImageUrl||Aligned to top-left corner||n/a|
|HDPosterUrl||Aligned to top-center||http://static.commentcamarche.net/ccm.net/faq/images/0-BX4VeV6H-resolution-comparison-s-.png|
|SDPosterUrl||Aligned to top-center||n/a|
|Title||Center-aligned relative to and displayed below PosterUrl||"Title for custom buffering screen"|
|Description||Left-aligned relative to PosterUrl||"Description for custom buffering screen"|
Custom Buffering Screen Using Content Meta-data (Custom Positioning)
For a complete custom buffering screen, setAdBufferScreenLayer() allows the same content meta-data attributes as setAdBufferScreenContent(), but enables you to customize the positioning and other roImageCanvas attributes.
For an example on different custom buffering screen implementations, see CustomBufferScreenSceneGraphSample.zip.
Custom Ad Parsing and Rendering
Custom Ad Parsing
Some applications may use an ad service that returns an unsupported response format, but can still take advantage of the library’s ad rendering features. In this case, the application is reponsible for requesting and parsing the ad response and structuring the ads into an array of pods according to the required Ad Structure. Scheduling and rendering can then proceed as described in Client Side Ad Insertion by first calling the importAds() method with the ad structure constructed externally by the client:
Custom Ad Rendering
Client applications may elect to control the ad rendering within the application, either to provide custom UI while loading ads, or because the ads are rendered by a method unsupported by the video ad library (e.g., by server-side video stitching). It is sufficient to make a single call to getAds() to get the entire Ad Structure. The client application is then responsible for using the
streams data to render the ads, and also must trigger the Tracking events when the requisite conditions are met.
The fireTrackingEvents() method is used to trigger event tracking, including client macro replacement and processing of Nielsen DAR beacons. The
adStructure parameter passed in to this method can be either an
adPod or a single ad from Ad Structure, depending on whether the event is relevant for the entire pod (such as
PodComplete) or for a single ad (all other event types). The
ctx parameter should contain either a
type string from the Tracking events or a
time numerical value for firing time-dependent events such as quartile beacons. If both are specified, the
type value takes precedence. Custom tracking event types can be added and fired as well, but client code should attempt to use conventional event types such as “Impression” where appropriate, as certain operations like Nielsen DAR parameter substitution rely on the “Impression” event type.
typevalues are case-sensitive, so will only fire events with names that match exactly the type specified.
Client code should fire all supported tracking events specified by Tracking during ad rendering when the appropriate conditions are met. Some events need not be fired such as
Error, which is specific to VAST parsing only. Events corresponding to operations unsupported during ad rendering also need not be fired, such as
AcceptInvitation (which is specific to ads with interactive elements).
As an example, if
ad contains the Ad Structure for a video ad that the client application has just begun rendering, the
Impression beacons for that ad could be fired with a single call:
While the ad playback progresses, assuming the variable
adProgressTime holds a value representing the number of seconds since the ad began rendering, the quartile beacons can be sent via:
If the ad were paused by the user, then the client app would fire the
Requirements for Server Side Ad Insertion
1. Frequency Capping and Targeting Requirements
For apps that serve ads via SSAI, the outbound ad call to the ad server is not made from the client. The app will have to assume the onus of passing the RIDA from the client to the server side component of the SSAI vendor or the ad server.
Please work with your SSAI vendor on how to pass the RIDA to the SSAI server side component. In some cases, the app may need to pass the RIDA as part of an ad call, in other cases there may be a web service that the app needs to call.
2. Nielsen Digital Ad Ratings Requirements
For server side ad inserted applications, call fireTrackingEvents() in RAF and ensure that the Nielsen beacons are passed to RAF via that API. It is valid to pass all impression beacons to RAF via this API. For non-Nielsen beacons, RAF will be just a pass-through.
All these data points are sent directly to Nielsen via RAF. RAF does not keep or save any of these data elements on the device or any cloud storage.
3. Uniform Ad Experience Requirements
To enhance user engagement and consistency of ads served on the Roku platform, RAF supports rendering of both video and interactive ads (from certain vendors such as Brightline and Innovid) in server-stitched streams. This allows Roku to display standard UI components and behavior (ad counter, ad timer, trickplay support, etc.) for server-stitched streams.
Any interactive ad types that are not enabled in RAF when server-stitched would need to be rendered by the application. See Custom Ad Rendering above.
There are two API methods required for these use cases. First, the application is responsible for requesting and parsing the ad response, and structuring the ads into an array of pods, according to the required Ad Structure. This ad metadata may, in some cases, come from a third party SDK provided by your stitching platform.
- For server stitched ads, the 'time' member of the 'tracking' data (in Ad Structure) for each ad is required. The value of this data member should correspond to the absolute time in the entire stream, not just relative to the current ad.
- Example: For a 30-second ad that starts at 15:00 in the stitched stream, the 'Impression' beacons for that ad should be set to 900 seconds and the 'Midpoint' beacons for that ad should be 915 seconds (i.e., @15:15). The 'time' member should still be omitted for beacons that do not depend on time (such as 'Pause' or 'AcceptInvitation').
- The meaning of postroll stitched ads is slightly different than for client-inserted ads, since the ads are part of the stream. Client code can still set the 'renderSequence' for the pod to 'postroll', but all time values should still refer to the absolute position within the stitched stream.
Scheduling and rendering is then initialized by first calling the
stitchedAdsInit() method with the ad structure constructed by the client:
Playback of the stitched stream is then started via an roVideoPlayer object (or optionally, a wrapped interface that matches the specification described in
stitchedAdHandledEvent()). In the event loop for the video player, the app should then first check if an ad renderer handled the event, as well as checking for exit condition. If no ad renderer handled the event, control falls through to the application’s regular event-handling logic:
- If currentAd = invalid, then no current ad is being rendered, and the app can handle the event normally.
- If currentAd <> invalid and currentAd.evtHandled = true, then the ad renderer handled the event, and no further action should be taken on that event.
- If currentAd.adExited = true, then the user exited the ad renderer and the app should exit playback and return to content selection.
- Only if no current ad is being rendered or currentAd.evtHandled = false should the app handle the event in any way. Keep in mind that ad rendering can create new roImageCanvas objects with their own navigation, or roVideoPlayer objects with their own internal state and position. These will in general have nothing at all to do with any such object created by the content playback app, yet they will share the same message port so that the application event loop can forward all events to the ad renderer first.
Alternatively, an roAssociativeArray can wrap and mimic the interface of the roVideoPlayer parameter of stitchedAdHandledEvent(). See method description for the minimum required key-value pairs. This wrapped interface is useful if there are other actions to be taken on player control methods (such as analytics fired when the stream is paused, etc.)
Testing your RAF Implementation
To test your RAF implementation, you do not need to pass any URL argument to
setAdUrl() as you would for the revenue split agreement and either omit the URL argument or the
setAdUrl() call entirely. This allows you to check that ads are served correctly to users of the channel, but no revenue will actually be generated.
Returns the Roku ad parser/renderer object.
This is the main entry point for instantiating the ad interface. The object returned has global scope, since it is meant to represent interaction with external resources (the ad server and any tracking services) that have persistence and state independent of the ad rendering within a client application. Manages ad server requests, parses ad structure, schedules and renders ads, and triggers tracking beacons.
fireTrackingEvents(adStructure as Object, ctx as Object) as Boolean
Triggers event tracking, including parameter substitution for Nielsen DAR, when library client code handles the ad rendering. Can be used in scenarios where the RAF ad renderer is not used (e.g., custom ad rendering or server-stitched ads).
true if all beacons of the requested type are successfully fired, otherwise false.
Client Ad Insertion
getAds(msg as string) as Object
Gets set of ads to be rendered now. When called with no parameters, this function returns the full list of all ad pods parsed from the ad server response. When called with the msg parameter, this function can be used as an event listener in the client application’s main video playback loop to check whether midroll or postroll ads should be shown or not.
available ad pod(s) scheduled for rendering or invalid, if none are available
showAds(ads as Object, ctx as Object, view as Object) as Boolean
Render any ads scheduled for display. When called with an array of ad pods (e.g., using the value returned from the initial call to getAds()), this is interpreted to mean that any preroll ad pod present should be rendered. Client applications should always check the return value and, if false, should exit content playback and return to the content selection screen. Typically, this occurs when the user presses the “Back” button during ad playback.
Please note the dimensions of the
1 Added in version 2.0. This argument is required for all SceneGraph applications.
stitchedAdHandledEvent(msg as Object, player as Object) as roAssociativeArray
Determines if a stitched ad is being rendered, lets the ad renderer attempt to handle the event, and returns metadata about the ad and the event handled state. This method is only intended for use in rendering server-stitched ads. The advertising framework must first be initialized using stitchedAdsInit() before calling this method.
The player parameter, if passed as an roAssociativeArray in an app where video is played with roVideoPlayer (non-RSG), must contain the following methods:
For RSG apps using a Video node for stitched ad playback, the player parameter should be an roAssociativeArray of the following form::
The return value, when an ad is being rendered, is of the form:
If the return value indicates that there is a stitched ad being rendered and that the event was handled by the renderer, the client application must take no action on that event. If the ad was exited, the client app should stop playback and return to the content selection screen.
setAdUrl(url as String)
Sets ad URL to use for a new getAds() request.
You can only receive payment for ads shown in your application when the Roku Ad Framework is properly configured with a valid URL assigned by your ad service or by Roku. Please contact email@example.com to discuss monetization options and obtain an ad URL if you wish to use Roku to fill ad inventory in your application. Using the default URL is useful only for development and testing purposes and you will not receive payment for ad impressions from the default URL.
getAdUrl() as String
Convenience function to get the currently-configured ad URL, or the default Roku ad server URL if none has been configured.
current ad URL
setContentGenre(genres as String, kidsContent as Boolean)
Allows potential ad targeting by specifying a set of genre tags to associate with the content or the ad request. Can clear genre tags by passing an empty string or omitting the parameter. The semantics and implementation of targeting based on genre values are dependent on the configured ad server, but for a list of currently-supported tags supported by the Roku ad server, refer to Roku Genre Tags.
setContentId(id as String)
Allows potential ad targeting by specifying an identifier for the content video. Passing an empty string or omitting the parameter will clear the content ID.
setContentLength(length as Integer)
Configures content length to extend ad targeting properties for Nielsen DAR. Also used for determining VMAP relative ad break times. If called with no parameter, will clear any prior content length set.
setAdPrefs(useRokuAdsAsFallback as Boolean, maxRequests as Integer)
Configures general ad request preferences. The default is for Roku to backfill ads if this method is not called or
Configure media constraints to filter renderable video ads. By default, the MIME types are configured for “video/mp4”, “video/mp4-h264”, “video/x-mp4”, “application/x-mpegurl”, and “application/json”. Any additional known types can be mapped to their stream format by setting this parameter before calling getAds().
setAdBreaks(contentLength as Integer, adBreakTimes as Integer)
Configures content playback parameters, which can be used for scheduling relative-positioned ad breaks in VMAP ad service responses. If you know that your application uses VMAP ad URLs and they are configured to use “nn%” timeOffset values, then you must specify the contentLength prior to calling getAds(). If VMAP is configured to use “#mm” timeOffset values, you must first specify a set of ad break times. Calling with empty parameters will reset these to invalid values. The content length can also be set independently via setContentLength() if ad break times are not required.
|setAdExit(enabled as Boolean)|
The default behavior is to enable exiting ad render (e.g., via “Back” button) to return to content selection screen in the application. Some use cases may require disabling this behavior if the user should not be allowed to skip ads when there is no applicable content selection mechanism.
importAds(adPodArray as Object)
Resets the internal ad pod cache to allow client code to import a set of ads from unsupported ad service response formats or when aggregating ads from multiple ad services. The application is responsible for ensuring that the ad pods in the array contain all the required data members.
enableJITPods(enabled as Boolean)
For applications that use a VMAP or SmartXML ad response to structure multiple ad pods, including midrolls, the JIT (or “Just In Time”) feature can be used to avoid pre-fetching all ad metadata before the content playback begins. When enabled, ad call redirects for midrolls are deferred until a certain time before the ad pod is rendered. This mechanism relies on the host app’s continuous use of the BrightScript getAds API method with the content video position event to determine when to resolve the deferred ads.
Note: JIT is used as a global setting; if the app has mixed content streams, where some content should not use JIT (such as server-stitched ads), then the host app is responsible for disabling this functionality before any ad calls are made for such streams.
setTrackingCallback(callback as Function, obj as Object)
Allows library client to set a callback function to be called when ad tracking events are fired or checked. Callback functions must have the signature:
setDebugOutput(enabled as Boolean)
Allows library client to configure extended debug output. Disabled by default.
getLibVersion() as String
Allows client applications to get the Roku Advertising Framework library version.
version string of the form “
|enableNielsenDAR(enabled as Boolean)|
Applications using Nielsen DAR must explicitly enable the framework to operate on the custom impression tag parameters.
Please contact firstname.lastname@example.org for more information on how to use audience measurement features.
setNielsenGenre(genre as String)
Allows for ad campaign measurement using Nielsen DAR tags by specifying a primary genre for the content being played, according to the Nielsen genres defined in Nielsen DAR Genre Tags. Examples: “CS” for an episode of “Seinfeld”, “N” for a “60 Minutes” episode.
setNielsenAppId(id as String)
Allows for ad campaign measurement using Nielsen DAR tags. The value of this application ID is uniquely assigned to your application by Nielsen and must be configured before rendering any ads containing Nielsen beacons.
setNielsenProgramId(id as String)
Allows for ad campaign measurement using Nielsen DAR tags. The value of this program ID should consistently reflect the program (movie title or series name) and should not uniquely identify episodic content. Examples: “The Price is Right”, “Beverly Hills 90210”, “Police Academy 7: Mission to Moscow”.
getNielsenContentData() as String
Returns an encrypted Nielsen RIDA parameter string for apps wishing to use the Nielsen SDK for DCR measurements.
An encrypted Nielsen RIDA parameter string
General Audience Measurement
Applications using audience measurement features must explicitly enable the framework to operate on the custom impression tag parameters, in conjunction with the setContentGenre(), setContentId(), and setContentLength() APIs to provide more valuable measurement data.
Please contact email@example.com for more information on how to use audience measurement features.
stitchedAdsInit(adPodArray as roArray)
Imports ad metadata to be used for server-stitched ad rendering and resets the internal state before handling events. The application is responsible for ensuring that the ad pods in the array contain all the required data members. In particular, for server-stitched ads, all time-dependent tracking beacons (Impression and quartile beacons) must have a valid time data member set, with a value relative to the entire stitched stream. For example, if a 30-second ad starts at 10:00 within the stitched stream, its Impression beacons should have track.time = 600.0 and its Midpoint beacons should have track.time = 615.0, and so on. This method is used in conjunction with
Buffer Screen Customization
setAdBufferScreenContent(contentMetaData as Object)
Allows the client application to set metadata for content used to populate the default ad buffer screen. contentMetaData conforms to the format defined in Content Meta-Data and can contain any or all of the following:
enableAdBufferMessaging(enableMsg as Boolean, enableProgressBar as Boolean)
Allows the client application to enable/disable specific features on the default ad buffer screen.
setAdBufferScreenLayer(zOrder as Integer, contentMetaData as Object)
Allows the client application to set individual layer metadata for custom ad buffer UI. contentMetaData conforms to the format defined in Content Meta-Data. Allowed values of both the zOrder and contentMetaData parameters are those allowed by roImageCanvas.
Allows the client application to clear all metadata in all layers previously set for the custom buffer screen.
setAdBufferRenderCallback(callback as Function, obj as Object, timeout as Integer)
Allows the client application set a callback function and timeout value for ad buffering events, to provide opportunity for analytics methods or animation of elements on custom buffer screen. The
The first parameter to this callback is the obj parameter, defined above. The eventType parameter can take the following values:
The ctx parameter is an roAssociativeArray that can contain the following:
URL Parameter Macros
The video ad library allows parameter values to be substituted in ad request and tracking URLs. This allows for dynamic configuration of values that are either not directly exposed to the client application or are unnecessary for it to initialize and maintain. These values are typically used for ad targeting, interaction tracking, and development purposes, or to optimize the ad experience for the user’s device.
|RIDA (Roku ID for Advertising) value used for device identification|
Set to true or false, depending on whether user has limited ad tracking
|Identifies the client application making the ad request|
Used to obtain the application version string
Used to obtain the RAF library version string
|Identifies the content to allow for ad targeting|
|Identifies the content categorization to allow for ad targeting|
Improves ad targeting by providing length of content (in number of seconds)
|Device model and firmware version|
|External IP address of the device|
|Width of device display|
|Height of device display|
Current timestamp value (number of milliseconds elapsed since 00:00:00 1/1/1970 GMT)
|Makes the URL unique to avoid retrieving cached ad server responses, or to ensure proper counting of unique event tracking beacons|
Mark ad requests as "directed towards children." This macro is designed to help your channel comply with the Children's Online Privacy Protection Act (COPPA)
To make an ad request that requires the application ID, user agent, and timestamp values, call setAdUrl() with those parameters set:
For a client application that must implement its own ad rendering, it is necessary to understand how the ad structure is represented in the BrightScript object returned from getAds(). The following is a description of the ad structure. Ad pods passed to showAds() must conform to this structure.
The object returned from a new call to getAds() with no parameters is an array of adPods in this format.
Tracking events are triggered automatically during ad rendering by showAds(). For client applications that perform their own ad rendering, the valid event types that must be handled are represented in the
tracking array of the Ad Structure by:
|Event name||Trigger condition|
|Start of ad render (e.g., first frame of a video ad displayed)|
|PodStart||Beginning of ad pod render|
|PodComplete||Completed rendering ad pod|
|FirstQuartile||25% of video ad rendered|
|Midpoint||50% of video ad rendered|
|ThirdQuartile||75% of video ad rendered|
|Complete||100% of video ad rendered|
|Error||Error during ad parsing or rendering (VAST 3.0)|
|Close||User exited out of ad rendering before completion|
|Skip||User skipped ad (if skippable)|
|Pause||User paused ad|
|Resume||User resumed ad|
|Rewind||User rewound ad|
|Mute||User muted ad|
|Unmute||User un-muted ad|
|AcceptInvitation||User launched another portion of an ad (for interactive ads)|
Roku Genre Tags
Tagging content by genre via setContentGenre() is specific to the ad provider, and may not be uniformly implemented. For ads provided by the Roku ad service, there is currently a canonical set of genre tags that can be used to improve ad targeting:
- Comedy drama
- Crime drama
- Dark comedy
- Historical drama
- Martial arts
- Musical comedy
- Performing arts
- Romantic comedy
- Science fiction
Nielsen DAR Genre Tags
Tagging content by genre via setNielsenGenre() requires a single primary genre code for the selected content from the following set of values. Publishers should provide the most specific category applicable to the content for which ads are to be shown.
|Award Ceremonies & Pageants||AC|
|Popular Music -Contemporary||PC|
|Popular Music -Standard||PS|
|Quiz -Give Away||QG|
image2017-10-17 16:8:51.png (image/png)