DTVR Browser SDK
From Engineering Client Portal
Prerequisites
To start using the Browser SDK, the following details are required:
- App ID (apid): Unique ID assigned to the player/site and configured by product.
- sfcode: Location of collection environment. Please set the sfcode to “dcr“.
If you do not have any of these pre-requisites or if you have any questions, please contact our SDK sales support team.
Configure SDK
There are two steps required for configuring your SDK: 1. Add Static Queue Snippet and 2. Create SDK Instance.
Add Static Queue Snippet
Add the following script tag to your 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");
</script>
The static queue snippet allows the SDK APIs to be called while the actual SDK and configuration file are still being downloaded. Since the queue is able to 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, you will need to create an SDK instance by making the initialization call:
NOLBUNDLE.nlsQ("<apid>", "<instanceName>",{nol_sdkDebug: "debug"})
When creating your instance, you will need to pass three parameter values. The available parameters are listed in the table below:
Parameters | Description | Value | Required? (Y/N) |
---|---|---|---|
apid | UniqueID assigned to player/site. | "XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX" | Yes |
instanceName | User-defined string value for describing the player/site. | Client specified | Yes |
sfcode | Location of collection environment. All traffic should be directed to "dcr". | Yes | |
nol_sdkDebug:"debug" | Enables Debug Mode which allows output to be viewed in console. | "{nol_sdkDebug: "debug"}" | No |
Example SDK Initialization
var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-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 your apid and 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 Initialization
Your configuration should include the Static Queue Snippet and an SDK Instance for your unique App ID as shown in the example:
//Add Static Queue Snippet
<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");
//Create SDK Instance
var nSdkInstance = NOLBUNDLE.nlsQ("XXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX", "nlsnInstance", {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 or live stream.
Key | Description | Values | Required |
---|---|---|---|
type | type of asset | "content" | ✓ |
channelName | Any string representing the channel/stream | custom | ✓ |
adModel | linear vs dynamic ad model | * 1) - Linear – matches TV ad load * 2) Dynamic – Dynamic Ad Insertion (DAI) | ✓ |
Example Content Object
var contentMetadataObject =
{
type: 'content',
channelName: 'Live Player',
adModel: '1'
};
Ad Metadata Object
The ad metadata should be passed for each individual ad, if ads are available during or before the stream begins.
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'
};
SDK Events
Event | Parameter | Description | |
---|---|---|---|
'loadMetadata' | content/ad metadata object | Needs to be called at the beginning of each asset to pass type, channelName, and adModel. | |
'sendID3' | Used to send the ID3 tag payload retrieved from the stream | Needs to be called at the beginning of playback | |
'end' | playhead position in seconds | Call when the current video asset completes playback or when a stream is interrupted. Example: At the end of the content stream, if the user switches to another piece of content, when the browser is refreshed or closed. |
Configure and fire API calls
The syntax for firing events is:
nSdkInstance.ggPM("event", parameter object);
Event is passed in parameter 1 and the argument is passed in parameter 2.
Configure API calls - loadMetadata
Use loadMetadata (Browser) to pass the metadata object. The data must be passed as a JSON string.
nSdkInstance.ggPM("loadMetadata", metadataObject);
Configure API calls - sendID3
Use sendID3 (Browser) to send ID3 payload of the HLS content being played. This will allow the ID3 payload to be sent every time an ID3 packet is received (approximately, once in every 10 seconds).
nSdkInstance.ggPM("sendID3", ID3_Object);
Sample ID3 tags
www.nielsen.com/X100zdCIGeIlgZnkYj6UvQ==/X100zdCIGeIlgZnkYj6UvQ==/AAAB2Jz2_k74GXSzx4npHuI_<wbr />JwJd3QSUpW30rDkGTcbHEzIMWleCzM-uvNOP9fzJcQMWQLJqzXMCAxParOb5sGijSV9dNM3QiBniJYGZ5GI-lL1fXTTN0IgZ4iWBmeRiPpS9AAAAAAAAAAAAAAAAAAAAAFJWFM5SVhTONNU=/00000/00000/00
www.nielsen.com/X100zdCIGeIlgZnkYj6UvQ==/R8WHe7pEBeqBhu8jTeXydg==/AAICoyitYqlxT7n6aZ0oMCGhe<wbr />Fi4CXFp46AMUPZz1lMr_M9tr3_cjee1SHqxrOiVerMDLeyn9xzocZSKwi746Re8vNOtpNCAZjYABs_J0R25IHpvOc1HS8<wbr />QHGgD5TgOJeS6gX100zdCIGeIlgZnkYj6UvVJWFNhSVhTiPE0=/00000/46016/00
ID3_Object
is the container to pass the retrieved ID3 tag from the streaming. The player should look for 'PRIV' ID3 tags and send 'owner' field (which typically starts from "www.nielsen.com") through this API. Refer to Browser SDK API Reference - Retrieving ID3 Tags for more information.
Refer to Browser SDK API Reference - Retrieving ID3 Tags section to know more details.
Configure API calls - end
Call end (Browser) only at the end of playback, or if the stream is interrupted.
nSdkInstance.ggPM("end", UTC_Timestamp);
SDK DTVR 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);
nSdkInstance.ggPM('sendID3', ID3_Payload);
//Upon completion of a stream, or upon an interruption scenario call 'end' and pass the UTC timestamp
nSdkInstance.ggPM('end', UTC_TIMESTAMP);
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://www.nielsen.com/digitalprivacy.
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.
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://www.nielsen.com/digitalprivacy.
Opt Back In
Once users have opted-out, they can choose to opt back into Nielsen Measurement at anytime by selecting the opt back in link on the Nielsen Digital Privacy Policy page. When a user selects the link, their opt-out cookie will be deleted and they will be able to be measured.
Going Live
Once the DCR Tracking Code is added to Instant Articles, Nielsen will validate the implementation. Following Nielsen testing, users need to make a couple of updates to the initialization call to ensure that the site is being measured properly.
- App ID: Ensure that correct <apid> is used during initialization
'PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
- Debug Logging: Disable logging by deleting
{nol_sdkDebug: 'DEBUG'}
from initialization call.- Example Production Initialization Call - Refer to the production initialization call below:
var nSdkInstance = NOLBUNDLE.nlsQ("PXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "nlsnInstance");
- Example Production Initialization Call - Refer to the production initialization call below: