Skip to content

Commit

Permalink
Merge pull request #61 from THEOplayer/feature/THEO-10603-conviva-sgai
Browse files Browse the repository at this point in the history
Feature/theo 10603 conviva sgai
  • Loading branch information
Jeroen-Veltmans authored Nov 15, 2024
2 parents 35c06f0 + de0bc43 commit ca8f5a0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-cherries-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@theoplayer/conviva-connector-web": minor
---

Added 'Server Guided' ad technology.
4 changes: 3 additions & 1 deletion conviva/src/integration/ads/AdReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
calculateCurrentAdBreakInfo,
collectAdMetadata,
collectPlayerInfo,
isServerGuidedAd,
updateAdMetadataForGoogleIma
} from '../../utils/Utils';

Expand Down Expand Up @@ -67,7 +68,8 @@ 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(currentAd);
// SGAI isn't officially supported by conviva yet, overwrite with our own string for now.
adMetadata['c3.ad.technology'] = isServerGuidedAd(currentAd) ? 'Server Guided' : calculateAdType(currentAd);

this.convivaAdAnalytics.setAdInfo(adMetadata);
this.convivaAdAnalytics.reportAdLoaded(adMetadata);
Expand Down
4 changes: 4 additions & 0 deletions conviva/src/utils/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export function collectDeviceMetadata(): ConvivaDeviceMetadata {
};
}

export function isServerGuidedAd(adOrBreak: Ad | AdBreak) {
return adOrBreak.integration === 'theoads';
}

export function calculateAdType(adOrBreak: Ad | AdBreak) {
switch (adOrBreak.integration) {
case 'theoads': {
Expand Down
8 changes: 5 additions & 3 deletions conviva/test/pages/main_esm.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
<head>
<meta charset="UTF-8"/>
<title>Connector test page</title>
<link rel="stylesheet" type="text/css" href="/node_modules/theoplayer/ui.css"/>
<script src="/node_modules/theoplayer/THEOplayer.js"></script>
<link rel="stylesheet" type="text/css" href="./../../../node_modules/theoplayer/ui.css"/>
<script src="./../../../node_modules/theoplayer/THEOplayer.js"></script>
<script src="./../../../node_modules/@convivainc/conviva-js-coresdk/conviva-core-sdk.js"></script>
<script src="./../../dist/conviva-connector.umd.js"></script>
</head>
<body>
<div id="THEOplayer" class="theoplayer-container video-js theoplayer-skin"></div>
Expand All @@ -15,7 +17,7 @@
ui: {
fluid: true
},
libraryLocation: '/node_modules/theoplayer/',
libraryLocation: './../../../node_modules/theoplayer/',
license: "CUSTOMER_LICENSE_GOES_HERE"
});

Expand Down
9 changes: 5 additions & 4 deletions conviva/test/pages/main_umd.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
<head>
<meta charset="UTF-8"/>
<title>Connector test page</title>
<link rel="stylesheet" type="text/css" href="/node_modules/theoplayer/ui.css"/>
<script src="/node_modules/theoplayer/THEOplayer.js"></script>
<script src="/dist/conviva-connector.umd.js"></script>
<link rel="stylesheet" type="text/css" href="./../../../node_modules/theoplayer/ui.css"/>
<script src="./../../../node_modules/theoplayer/THEOplayer.js"></script>
<script src="./../../../node_modules/@convivainc/conviva-js-coresdk/conviva-core-sdk.js"></script>
<script src="./../../dist/conviva-connector.umd.js"></script>
<script type="text/javascript" src="//imasdk.googleapis.com/js/sdkloader/ima3_debug.js"></script>
</head>
<body>
Expand All @@ -16,7 +17,7 @@
ui: {
fluid: true
},
libraryLocation: '/node_modules/theoplayer/',
libraryLocation: './../../../node_modules/theoplayer/',
license: "CUSTOMER_LICENSE_GOES_HERE"
});

Expand Down

0 comments on commit ca8f5a0

Please sign in to comment.