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/slate reporting #46

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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/chilled-knives-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@theoplayer/conviva-connector-web": minor
---

Added reporting of slate for THEOads.
6 changes: 3 additions & 3 deletions conviva/src/integration/ads/AdReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class AdReporter {
private readonly onAdBreakBegin = (event: any) => {
this.currentAdBreak = event.ad as AdBreak;
this.convivaVideoAnalytics.reportAdBreakStarted(
calculateAdType(this.player),
calculateAdType(this.currentAdBreak),
Constants.AdPlayer.CONTENT,
calculateCurrentAdBreakInfo(this.currentAdBreak, this.adBreakCounter)
);
Expand Down Expand Up @@ -67,7 +67,7 @@ export class AdReporter {
this.contentInfo()[Constants.ASSET_NAME] ?? this.player.source?.metadata?.title ?? 'NA';

// [Required] The ad technology as CLIENT_SIDE/SERVER_SIDE
adMetadata['c3.ad.technology'] = calculateAdType(this.player);
adMetadata['c3.ad.technology'] = calculateAdType(currentAd);

this.convivaAdAnalytics.setAdInfo(adMetadata);
this.convivaAdAnalytics.reportAdLoaded(adMetadata);
Expand All @@ -80,7 +80,7 @@ export class AdReporter {
this.convivaAdAnalytics.reportAdMetric(Constants.Playback.BITRATE, (currentAd as GoogleImaAd).bitrate || 0);

// Report playing state in case of SSAI.
if (calculateAdType(this.player) === Constants.AdType.SERVER_SIDE) {
if (calculateAdType(currentAd) === Constants.AdType.SERVER_SIDE) {
this.convivaAdAnalytics.reportAdMetric(Constants.Playback.PLAYER_STATE, Constants.PlayerState.PLAYING);
}
};
Expand Down
24 changes: 21 additions & 3 deletions conviva/src/utils/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,26 @@ export function collectDeviceMetadata(): ConvivaDeviceMetadata {
};
}

export function calculateAdType(player: ChromelessPlayer) {
return player.source?.ads?.length ? Constants.AdType.CLIENT_SIDE : Constants.AdType.SERVER_SIDE;
export function calculateAdType(adOrBreak: Ad | AdBreak) {
switch (adOrBreak.integration) {
case 'theoads': {
// TODO: THEOads is a Server-Guided Ad Insertion (SGAI) solution, which can't be reported to Conviva as such yet.
return Constants.AdType.SERVER_SIDE;
}
case undefined:
case '':
case 'csai':
case 'theo': // Deprecated
case 'google-ima':
case 'spotx':
case 'freewheel': {
return Constants.AdType.CLIENT_SIDE;
}
default: {
// CustomAdIntegrationKinds are server side ad connectors.
return Constants.AdType.SERVER_SIDE;
}
}
}

export function calculateVerizonAdBreakInfo(adBreak: VerizonMediaAdBreak, adBreakIndex: number): ConvivaAdBreakInfo {
Expand Down Expand Up @@ -178,7 +196,7 @@ export function collectAdMetadata(ad: Ad): ConvivaMetadata {

// [Preferred] A boolean value that indicates whether this ad is a Slate or not.
// Set to "true" for Slate and "false" for a regular ad. By default, set to "false"
adMetadata['c3.ad.isSlate'] = 'false';
adMetadata['c3.ad.isSlate'] = `${Boolean(ad.isSlate)}`;

// [Preferred] Only valid for wrapper VAST responses.
// This tag must capture the "first" Ad Id in the wrapper chain when a Linear creative is available or there is
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"prettier": "^3.2.4",
"rimraf": "^5.0.5",
"rollup": "^4.14.0",
"theoplayer": "^7.4.1",
"theoplayer": "^7.12.0",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"tslib": "^2.6.2",
Expand Down