Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/nielsen dcr #45

Merged
merged 55 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
8ff3ca1
Add tested countries
wjoosen Aug 19, 2024
7fbdeb7
Load separate static queue snippet for different country configurations
wjoosen Aug 19, 2024
b9208da
appId placeholder string
wjoosen Aug 19, 2024
8541e1b
Reference to CZ docs
wjoosen Aug 19, 2024
9516b27
Rename DTVR Content Metadata
wjoosen Aug 19, 2024
9352600
Add example content metadata object for CZ DCR
wjoosen Aug 19, 2024
04bdf84
Add ContentMetadata types split up in generic, US and CZ specific pro…
wjoosen Aug 19, 2024
1d5dc5a
Add CZ Ad metadata type
wjoosen Aug 20, 2024
38c5740
Add configuration type
wjoosen Aug 20, 2024
083b2ca
pass country configuration to static queue snippet loading function
wjoosen Aug 20, 2024
9b1d992
store configuration parameters in handler
wjoosen Aug 20, 2024
6d052ee
updateMetadata improvements
wjoosen Aug 21, 2024
ca2de34
introduce DCRContentMetadata field
wjoosen Aug 21, 2024
b6bc9a6
tweak if statement
wjoosen Aug 21, 2024
e81ae1a
only send onLoadMetadata with dtvr metadata if dtvr is enabled
wjoosen Aug 21, 2024
059f61f
only send play event if dtvr is enabled
wjoosen Aug 21, 2024
8cc288e
send loadMetadata event for DCR on first play event
wjoosen Aug 21, 2024
a12d29f
adjust types
wjoosen Aug 21, 2024
0487a5f
separate ad metadata reporting logic for dcr and dtvr
wjoosen Aug 21, 2024
a95ac85
set initial adMetadata io placeholder values
wjoosen Aug 22, 2024
05c7477
take first array item of filtered currentAds and add TODO note
wjoosen Aug 22, 2024
50f7b9f
import
wjoosen Aug 22, 2024
23cf5c7
Report playhead position
wjoosen Aug 22, 2024
b4a7ca4
only report playhead position when DCR is enabled
wjoosen Aug 22, 2024
bdae3eb
dont listen for timed metadata if DTVR is not enabled
wjoosen Aug 22, 2024
0713d95
send stop event when an ad ends
wjoosen Aug 22, 2024
4e67802
report end before post roll starts
wjoosen Aug 22, 2024
8a9fc8e
typo
wjoosen Aug 22, 2024
235f9ae
add and remove listener
wjoosen Aug 22, 2024
3a7f857
rewrite
wjoosen Aug 22, 2024
62a787b
only report setVolume for DTVR
wjoosen Aug 22, 2024
520838c
remove comments
wjoosen Aug 22, 2024
5918b31
ignore NaN duration change events
wjoosen Aug 22, 2024
2447323
detect post rolls for DAI sources too
wjoosen Aug 22, 2024
85b4c30
report stop if an ad was playing in the onEnd handler
wjoosen Aug 22, 2024
62ef2fc
report stop on more interrupt scenarios
wjoosen Aug 22, 2024
824079a
adapt build ad metadata helper to new getAdType implementation
wjoosen Aug 22, 2024
2f8dec3
Add public DCR metadata types
wjoosen Aug 22, 2024
5fce7b8
convert provided metadata to types imposed by nielsen dcr docs
wjoosen Aug 22, 2024
66b72c5
expose updateDCRContentMetadata
wjoosen Aug 22, 2024
d0edda9
add configuration parameter
wjoosen Aug 22, 2024
674e01a
add import
wjoosen Aug 22, 2024
f1cae07
edit paths
wjoosen Aug 22, 2024
0e5d9bd
edit librarylocation path
wjoosen Aug 22, 2024
0f55a07
edit serve script
wjoosen Aug 22, 2024
84afa8d
set sessionInProgress to true regardless of DCR/DTVR config
wjoosen Aug 22, 2024
e3f6673
use Ad from AdBeginEvent
wjoosen Aug 22, 2024
2448e81
update README
wjoosen Aug 22, 2024
7f6391c
typo
wjoosen Aug 22, 2024
1005a44
add necessary type exports
wjoosen Aug 22, 2024
8abc60c
finish example page
wjoosen Aug 22, 2024
e0e5fd4
Add changeset
wjoosen Aug 22, 2024
f1cbb0d
edit example metadata
wjoosen Aug 22, 2024
ecaa04b
always include nol_c2 property
wjoosen Aug 22, 2024
44bc3e5
only print logs if nol_sdkDebug === "debug"
wjoosen Aug 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/chilly-yaks-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@theoplayer/nielsen-connector-web": minor
---

Add DCR support (CZ and US).
66 changes: 53 additions & 13 deletions nielsen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,79 @@ npm install @theoplayer/nielsen-connector-web

### Configuring the connector

Create the connector by providing the `THEOplayer` instance, the Nielsen App ID, the channelName for the asset
and optionally some Nielsen configuration.
Create the connector by providing the following mandatory parameters:

- The `THEOplayer` instance
- the Nielsen App ID
- the channelName for the asset

and optionally the following parameters:

- a `NielsenOptions` object
- a `NielsenConfiguration` object (if none is provided, the default configuration disables DCR, enables DTVR and sets the country to US)

```js
import {NielsenConnector} from "../../dist/THEOplayerNielsenConnector";
import { NielsenConnector } from '../../dist/THEOplayerNielsenConnector';

const appId = '<your app ID>';
const channelName = '<your channel name>';
// Optional

// Non-mandatory options
const options: NielsenOptions = {
containerId: 'THEOplayer',
containerId: 'THEOplayer',
optout: false
}
};

// Non-mandatory configuration (e.g. for DCR tracking with the Czech Republic SDK)
const configuration: NielsenConfiguration = {
country: NielsenCountry.CZ,
enableDTVR: false,
enableDCR: true
};
const nielsenConnector = new NielsenConnector(player, appId, channelName, options);
```

The `NielsenOptions` can have the following fields:

| Key | Value |
|-----------------|-----------------------------------------------------------------|
| ` containerId ` | HTML DOM element id of the player container. |
| --------------- | --------------------------------------------------------------- |
| `containerId` | HTML DOM element id of the player container. |
| ` nol_sdkDebug` | Enables Debug Mode which allows output to be viewed in console. |
| ` optout ` | Whether to opt-out of Nielsen Measurement. |
| `optout` | Whether to opt-out of Nielsen Measurement. |

### Passing metadata dynamically
### Passing metadata dynamically (DTVR)

The connector allows updating the current asset's metadata at any time:
The connector allows updating the current asset's metadata at any time. Note that Nielsen's [documentation](<https://engineeringportal.nielsen.com/wiki/updateMetadata_(Browser)>) prohibits updating of the values for `type`, `vidtype` or `assetid` parameters

```js
const metadata = {
['channelName']: 'newChannelName',
['customTag1']: 'customValue1',
['customTag2']: 'customValue2'
}
['customTag2']: 'customValue2'
};
nielsenConnector.updateMetadata(metadata);
```

### Passing metadata when setting a source to the player (DCR)

This can be achieved through the `updateDCRContentMetadata` method, e.g.:

```js
const metadata: NielsenDCRContentMetadataCZ = {
assetid: 'cz-500358-98731568435405',
program: 'Animated Test Content',
title: 'Big Buck Bunny',
length: '596',
airdate: '20230620 20:00:00',
isfullepisode: true,
crossId1: '915 954 39504',
c2: '651678089925925',
segB: '011',
adloadtype: AdLoadType.linear,
hasAds: HasAds.supports_ads
};

nielsenConnector.updateDCRContentMetadata(metadata);
```

Note that types are included in the package: `NielsenDCRContentMetadataUS`, `NielsenDCRContentMetadataCZ`. Please contact your THEO Technologies representative if you need support for another International DCR SDK.
2 changes: 1 addition & 1 deletion nielsen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"bundle": "rollup -c rollup.config.mjs",
"watch": "npm run bundle -- --watch",
"build": "npm run clean && npm run bundle",
"serve": "http-server",
"serve": "http-server ./.. -o /nielsen/test/pages/main.html",
"test": "jest"
},
"author": "THEO Technologies NV",
Expand Down
11 changes: 10 additions & 1 deletion nielsen/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
export { NielsenConnector } from './integration/NielsenConnector';
export { NielsenOptions } from './nielsen/Types';
export {
NielsenOptions,
NielsenDCRContentMetadata,
NielsenDCRContentMetadataCZ,
NielsenDCRContentMetadataUS,
NielsenConfiguration,
NielsenCountry,
AdLoadType,
HasAds
} from './nielsen/Types';
16 changes: 13 additions & 3 deletions nielsen/src/integration/NielsenConnector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ChromelessPlayer } from 'theoplayer';
import { NielsenOptions } from '../nielsen/Types';
import { NielsenConfiguration, NielsenDCRContentMetadata, NielsenOptions } from '../nielsen/Types';
import { NielsenHandler } from './NielsenHandler';

export class NielsenConnector {
Expand All @@ -13,14 +13,24 @@ export class NielsenConnector {
* @param instanceName User-defined string value for describing the player/site.
* @param options Additional options.
*/
constructor(player: ChromelessPlayer, appId: string, instanceName: string, options?: NielsenOptions) {
this.nielsenHandler = new NielsenHandler(player, appId, instanceName, options);
constructor(
player: ChromelessPlayer,
appId: string,
instanceName: string,
options?: NielsenOptions,
configuration?: NielsenConfiguration
) {
this.nielsenHandler = new NielsenHandler(player, appId, instanceName, options, configuration);
}

updateMetadata(metadata: { [key: string]: string }): void {
this.nielsenHandler.updateMetadata(metadata);
}

updateDCRContentMetadata(metadata: NielsenDCRContentMetadata): void {
this.nielsenHandler.updateDCRContentMetadata(metadata);
}

destroy() {
this.nielsenHandler.destroy();
}
Expand Down
Loading