DCR Video Browser SDK: Difference between revisions
From Engineering Client Portal
No edit summary |
No edit summary |
||
Line 68: | Line 68: | ||
|- | |- | ||
| nol_sdkDebug || Enables Nielsen console logging. Only required for testing || "{nol_sdkDebug: "debug"})" | | nol_sdkDebug || Enables Nielsen console logging. Only required for testing || "{nol_sdkDebug: "debug"})" | ||
|- | |||
|optout || OptOut global parameter || 1 or 0 | |||
|} | |} | ||
Revision as of 22:27, 11 February 2019
Prerequisites
To start using the App SDK, the following items are required:
Item | Description | Source | |
---|---|---|---|
☑ | App ID (appid) | Unique ID assigned to the player/site and configured by product. | Contact Nielsen |
Configure SDK
There are two steps required for configuring the SDK:
- Add Static Queue Snippet
- Create SDK Instance
Static Queue Snippet
Add the following script tag to the website:
<script>
!function(t,n)
{
t[n]=t[n]||
{
nlsQ:function(e,o,c,r,s,i)
{
return s=t.document,
r=s.createElement("script"),
r.async=1,
r.src=("http:"===t.location.protocol?"http:":"https:")+"//cdn-gl.imrworldwide.com/conf/"+e+".js#name="+o+"&ns="+n,
i=s.getElementsByTagName("script")[0],
i.parentNode.insertBefore(r,i),
t[n][o]=t[n][o]||{g:c||{},
ggPM:function(e,c,r,s,i){(t[n][o].q=t[n][o].q||[]).push([e,c,r,s,i])}},t[n][o]
}
}
}
(window,"NOLBUNDLE");
var nSdkInstance = NOLBUNDLE.nlsQ("PXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "nlsnInstance");
</script>
The static queue snippet allows the SDK APIs to be called while the actual SDK and configuration file are still being downloaded. As the queue can capture all API calls before the download completes, there is no wait time. Once the SDK is available, the API calls will transition from directing to the queue to the SDK seamlessly.
Create SDK Instance
To initialize the SDK, create an SDK instance by making the initialization call:
Initialization API Call
NOLBUNDLE.nlsQ("<apid>", "<instanceName>",{nol_sdkDebug: "debug"})
When creating an instance, pass the following three values:
Parameter | Description | Values |
---|---|---|
apid | Unique ID assigned to player/site | 'PXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' |
instanceName | Name of SDK instance | "any string value" |
nol_sdkDebug | Enables Nielsen console logging. Only required for testing | "{nol_sdkDebug: "debug"})" |
optout | OptOut global parameter | 1 or 0 |
Example SDK Initialization
var nSdkInstance = NOLBUNDLE.nlsQ("PXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", {nol_sdkDebug: "debug"});
When the initialization call is made, a unique static configuration file, <apid>.js, will be downloaded based on the apid and will be cached on the user’s browser.
Once the configuration is downloaded, the SDK itself will be downloaded and initialized. All SDK modules are included in one file: “nlsSDK600.bundle.min.js”.
Example SDK Configuration
The configuration should include the Static Queue Snippet and an SDK Instance for an unique App ID as shown in the example:
<script type="text/javascript">
// Add Static Queue Snippet
!function(t,n)
{
t[n]=t[n]||
{
nlsQ:function(e,o,c,r,s,i)
{
return s=t.document,
r=s.createElement("script"),
r.async=1,
r.src=("http:"===t.location.protocol?"http:":"https:")+"//cdn-gl.imrworldwide.com/conf/"+e+".js#name="+o+"&ns="+n,
i=s.getElementsByTagName("script")[0],
i.parentNode.insertBefore(r,i),
t[n][o]=t[n][o]||{g:c||{},
ggPM:function(e,c,r,s,i){(t[n][o].q=t[n][o].q||[]).push([e,c,r,s,i])}},t[n][o]
}
}
}
(window,"NOLBUNDLE");
// Created SDK Instance
var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX","myPlayerName", {clientid: "it-123456", vcid: "c01", nol_sdkDebug: "debug"});
</script>
Create Metadata Objects
There are two types of asset metadata:
- content: identify video
- ad: identify each ad
The metadata received for each asset is used for classification and reporting.
Metadata can be passed through key-values using the Nielsen reserved keys. User will need to set up content and ad objects with the required Nielsen keys as shown in the sample code below.
Content Metadata
Content metadata should remain constant throughout the completion of an episode / clip including the ads play.
Key | Description | Values | Required |
---|---|---|---|
clientid |
parent ID – value is automatically populated through provided App ID. |
Nielsen provided |
|
vcid | sub-brand ID – value is automatically populated through provided App ID. In order to override the sub-brand configured to the App ID, value can |
Nielsen provided |
|
type | type of asset | "content" | ✓ |
assetid | unique ID assigned to asset | custom (no Special Characters) |
✓ |
program | name of program (100 character limit) | custom | ✓ |
title | episode title (100 character limit) | custom | ✓ |
length | length of content in seconds | seconds (0 for live stream) | ✓ |
mediaURL | URL location of the content being streamed | custom | |
segB | custom segment B | custom | |
segC | custom segment C | custom | |
airdate | the airdate in the linear TV | YYYYMMDD HH:MI:SS | ✓ |
isfullepisode | full episode flag |
|
✓ |
crossId1 | standard episode ID | custom | ✓ |
crossId2 | content originator (only required for distributors) | Nielsen provided | |
adloadtype | type of ad load:
|
|
✓ |
Example Content Object
var contentMetadataObject =
{
type: 'content',
assetid: 'VID123-123456',
program: 'program name',
title: 'episode title',
length: 'length in seconds',
mediaURL: 'http://www.site.com/videoAsset',
segB: 'custom segment B',
segC: 'custom segment C',
airdate: 'YYYYMMDD HH:MI:SS',
isfullepisode: 'y',
crossId1: 'Standard Episode ID',
crossId2: 'Content Originator',
adloadtype: '2'
};
Ad Metadata Object
The ad metadata should be passed for each individual ad.
Keys | Description | Values | Required |
---|---|---|---|
type | type of ad | 'preroll', 'midroll', or 'postroll' | ✓ |
assetid | unique ID assigned to ad | custom | ✓ |
Example Ad Object
var adMetadataObject =
{
assetid: 'AD-1',
type: 'preroll'
};
URL Character Limit: There is a URL character limit of 2K characters due to browser limitations. Exceeding this value could impair data delivery on particular browsers.
Call Nielsen APIs
The method for calling events is ggPM().
nSdkInstance.ggPM('event', parameter, ...);
Interrupt Scenarios
Pause Event
The setPlayheadPostion event is used for handling pause. To indicate pause, stop passing the playhead position to the SDK. Once the content resumes, begin sending the playhead again with the correct playhead value.
Other Interrupt Scenarios
The following possible browser interruption scenarios must be handled:
- Browser/Tab close
- Leaving the page to another destination
- Pressing the stop button
There are many cases where the player itself has the ability to detect such situations. If not, these interruption scenarios can be handled through JavaScript. The events that are called will depend on the asset being played (e.g. midroll vs. content).
window.addEventListener('beforeunload', function(event)
{
// Only inside a midroll indicate <stop> for the ad
nSdkInstance.ggPM('stop', playheadPosition);
// Indicate <end> and <stop> for the content
nSdkInstance.ggPM('end', playheadPosition);
nSdkInstance.ggPM('stop', playheadPosition);
});
Note: User may need to add code to support specific browser versions (e.g. older versions of Internet Explorer).
SDK Events
Event | Parameter | Description |
---|---|---|
'loadMetadata' | content/ad metadata object | Needs to be called at the beginning of each asset |
'setPlayheadPosition' | playhead position as integer VOD: || current position in seconds |
Pass playhead position every second during playback |
'stop' | playhead position | Call when content or ads complete playing and pass playhead position |
'end' | playhead position in seconds | Call when the current video asset completes playback and pass the playhead position. Example: At the end of the content stream, if the user switches to another piece of content, when the browser is refreshed or closed. |
SDK Playhead Event Sequence
The sample event lifecycle can be used as a reference for identifying the order for calling events.
// START OF STREAM
nSdkInstance.ggPM('loadMetadata', contentMetadataObject);
// PREROLL
nSdkInstance.ggPM('loadMetadata', prerollMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
//
// pass playhead every second
//
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
nSdkInstance.ggPM('stop', playheadPosition);
// CONTENT
nSdkInstance.ggPM('loadMetadata', contentMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
//
// pass playhead every second
//
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
nSdkInstance.ggPM('stop', playheadPosition);
// MIDROLL
nSdkInstance.ggPM('loadMetadata', midrollMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
//
// pass playhead every second
//
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
nSdkInstance.ggPM('stop', playheadPosition);
// CONTENT
nSdkInstance.ggPM('loadMetadata', contentMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
//
// pass playhead every second
//
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
nSdkInstance.ggPM('end', playheadPosition);
// POSTROLL
nSdkInstance.ggPM('loadmetadata', postrollMetadataObject);
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
//
// pass playhead every second
//
nSdkInstance.ggPM('setPlayheadPosition', playheadPosition);
nSdkInstance.ggPM('stop', playheadPosition);
- 'setPlayheadPosition' is used for calculating duration and must be passed every second. The final playhead position must be sent for the current asset being played before calling 'stop', 'end', or 'loadmetadata'.
- For Ad Pods, events must be called for each individual Ad. Each Ad playhead position should begin at ‘0’ when ad starts.
- When content has resumed following an ad break, the playhead position update must continue where previous content segment left off. The playhead position should be passed as a rounded number with no decimals.
Nielsen Opt-Out
The site must provide a means for the user to opt-out of, or opt back into, Nielsen Measurement. A user can opt-out if they would prefer not to participate in any Nielsen online measurement research. To implement the opt-out option, include the following two items in your privacy policy.
- A notice that the player includes proprietary measurement software that allows users to contribute to market research (such as Nielsen TV Ratings).
- A link to the Nielsen Digital Measurement Privacy Policy at http://priv-policy.imrworldwide.com/priv/browser/us/en/optout.html.
On the Nielsen Digital Measurement Privacy Policy page, users can click Choices to read more detailed information about the measurement software, learn about their options with regard to Nielsen measurement, and, if they do not want to participate in Nielsen online measurement, click a link to receive an opt-out cookie.
- Once users have opted out via this link, their browser cookies will contain the value TOTAL_OPTOUT. This will prevent a redirect to our data provider from occurring
- Users can opt back in via this link. When a user selects that link, their opt-out cookie will be deleted and they will be able to be measured moving forward.
The following paragraph is a template for an opt-out statement.
The properties may feature Nielsen proprietary measurement software, which will allow users to contribute to market research, such as Nielsen TV Ratings. To learn more about the information that Nielsen software may collect and your choices, please see the Nielsen Digital Measurement Privacy Policy at http://priv-policy.imrworldwide.com/priv/browser/us/en/optout.htm
Going Live
After the integration has been certified, users will need to make a couple of updates to the initialization call to ensure that player will be measured properly. Disable debug logging by deleting {nol_sdkDebug: 'DEBUG'} from initialization call. Example Production Initialization Call
var nSdkInstance = NOLBUNDLE.nlsQ("PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "nlsnInstance");