Context Script + Adaptive Plugin
Overview: The Context Script gives publishers the ability to retrieve Context Data Segments on a given asset. This is meant to be used as a part of your ad workflow to send context data through your ad server. This documentation will walk through how clients using the Adaptive Plugin can add the Context Script and retrieve context for the initial asset and IRIS.TV recommendations.
See example implementation page here: https://ovp.iris.tv/demos/context/iris-context-api-autoplay.html
Prerequisites
This workflow requires two values:
client_token: Authentication string associated with each client. This will be provided by IRIS.TV once the content feed is imported.
NOTE: Brightcove clients' client_token is their Brightcove Account ID.
platform_id: The reference ID for the asset from the publisher’s CMS.
- 1 Prerequisites
- 2 Building the Integration
- 2.1 Installing the Script
- 2.2 Initializing the Script
- 2.3 Using the Script
- 2.3.1 Initial Video: Using the getVideoInfo route to retrieve context segments
- 2.3.1.1 Parameters for this getVideoInfo route
- 2.3.1.2 Steps
- 2.3.1.3 Sample formatting of the getVideoInfo request
- 2.3.1.4 Example of response for getVideoInfo
- 2.3.2 Recommended Videos: Using the getRecommendationInfo route to retrieve context segments
- 2.3.2.1 Steps
- 2.3.2.2 Sample formatting of the getRecommendationInfo request
- 2.3.1 Initial Video: Using the getVideoInfo route to retrieve context segments
Building the Integration
The order of operations for retrieving the context or category information should be as follows:
IRIS.TV Context Script is loaded with the page.
The context script is initialized.
Call script getVideoInfo route to retrieve the context segments for the initial asset ID.
Add either the context segment to the pre-roll ad tag for the initial asset ID. Please confirm with your account manager which field will be used for your integration.
Call script method to retrieve context segments for all Adaptive Plugin recommendations and store data on the client-side.
Add context segments to the pre-roll for 1st recommendation.
Repeat Step 6 for each new IRIS.TV recommendation.
Installing the Script
Add the following script to the top of your page: https://ovp.iris.tv/libs/context/iris-context.min.js
NOTE: The script should be loaded as a high priority to ensure you can receive context information for the pre-roll of the initial video.
An example of adding the script to your page HTML:
<script src=”https://ovp.iris.tv/libs/context/iris-context.min.js” type=”text/javascript”></script>
If you do not want to load the script as a high-priority, there is an event that you can listen to at the global-changes level to ensure that the context methods are available. An example of setting up that event listener:
window.addEventListener(‘IrisContextAPI’, function() {
// window.IrisContextAPI is ready to be used
});
Initializing the Script
To initialize the script, provide the following to the IrisContextAPI Object:
client_token
var IrisContext = window.IrisContextAPI({
client_token: '<your client token here>',
});
Using the Script
Once the script is initialized, you can send in the video ID of the initial video to retrieve context segments.
Please confirm with your IRIS.TV Account Manager:
Where the context segments should be added within the ad tag (i.e. in the “cust_params” field in a DFP tag).
Initial Video: Using the getVideoInfo route to retrieve context segments
Parameters for this getVideoInfo route
platform_id: reference ID of the video. Required
Steps
Send platform_id to getVideoInfo route.
Retrieve context segments from getVideoInfo,.
Send context segments in the pre-roll ad call for the initial video.
Sample formatting of the getVideoInfo request
Example of response for getVideoInfo
Recommended Videos: Using the getRecommendationInfo route to retrieve context segments
Steps
Call
getRecommendationsInfo
route as a part of callbacks for IRIS.TV /watch and /next API routes, which are exposed through the irisResponseReady event.You only need to create this event along with the getRecommendationsInfo route once
You need to send the e.detail.platform_id value as shown below
Store data returned from
getRecommendationsInfo
so it can be used to retrieve data each recommended video.On video load, query player for ID of the video and then query stored platform_id values for context segments.
Send context segments data in the pre-roll ad call for the video.
Sample formatting of the getRecommendationInfo request
IRIS.TV