Skip to content

Commit

Permalink
Merge pull request #994 from googleads/omsdk
Browse files Browse the repository at this point in the history
adds feature flags and OMSDK APIs
  • Loading branch information
Kiro705 authored May 6, 2021
2 parents 345b828 + f781004 commit 1e7ec7a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,14 @@ the previous snippet. A summary of all settings follows:
| disableAdControls | boolean | True to hide the ad controls(play/pause, volume, and fullscreen buttons) during ad playback. Defaults to false. |
| disableCustomPlaybackForIOS10Plus | boolean | Sets whether to disable custom playback on iOS 10+ browsers. If true, ads will play inline if the content video is inline. Defaults to false. |
| disableFlashAds | boolean | True to disable Flash ads - Flash ads will be considered an unsupported ad type. Defaults to false. |
| featureFlags | object | Sets IMA SDK feature flags. |
| forceNonLinearFullSlot | boolean | True to force non-linear AdSense ads to render as linear fullslot. If set, the content video will be paused and the non-linear text or image ad will be rendered as fullslot. The content video will resume once the ad has been skipped or closed. |
| id | string | **DEPRECATED** as of v.1.5.0, no longer used or required. |
| locale | string | Locale for ad localization. The supported locale codes can be found in [Localizing for Language and Locale](//developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/localization)|
| nonLinearHeight | number | Desired height for non-linear ads. Defaults to 1/3 player height. |
| nonLinearWidth | number | Desired width of non-linear ads. Defaults to player width. |
| numRedirects | number | Maximum number of VAST redirects before the subsequent redirects will be denied and the ad load aborted. The number of redirects directly affects latency and thus user experience. This applies to all VAST wrapper ads. |
| omidMode | object | Sets and enables the Open Measurement SDK(4). Accepts an object with keys 'LIMITED', 'DOMAIN', and 'FULL'. The value pair for each key should be a dictionary that maps each access mode to a regular expression that matches the URLs to include. This API is currently in open beta and requires the following feature flag to be set: `{'enableOmidBeta': true}` |
| ppid | string | Sets the publisher provided ID |
| preventLateAdStart | boolean | Prevent ads from starting after the content has started if an adtimeout occurred (preroll, midroll, postroll). The default value is false
| sessionId | string | Sets the [session ID](//developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.ImaSdkSettings#setSessionId) |
Expand All @@ -177,7 +179,7 @@ the previous snippet. A summary of all settings follows:
<br />
(3) [contrib-ads plugin](//github.com/videojs/videojs-contrib-ads)
<br />
(4) [Valid locale codes](//developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/localization)
(4) [Open Measurement SDK guide](//developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/omsdk)
<br />
(5) [ImaSdkSettings.setVpaidMode](//developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.ImaSdkSettings#setVpaidMode)

Expand Down
23 changes: 23 additions & 0 deletions src/sdk-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@ const SdkImpl = function(controller) {
if (this.controller.getSettings().ppid) {
google.ima.settings.setPpid(this.controller.getSettings().ppid);
}

if (this.controller.getSettings().featureFlags) {
google.ima.settings
.setFeatureFlags(this.controller.getSettings().featureFlags);
}
};


Expand Down Expand Up @@ -222,6 +227,24 @@ SdkImpl.prototype.requestAds = function() {
adsRequest.vastLoadTimeout = this.controller.getSettings().vastLoadTimeout;
}

if (this.controller.getSettings().omidMode) {
adsRequest.omidAccessModeRules = {};
const omidValues = this.controller.getSettings().omidMode;

if (omidValues.FULL) {
adsRequest.omidAccessModeRules[google.ima.OmidAccessMode.FULL] =
omidValues.FULL;
}
if (omidValues.DOMAIN) {
adsRequest.omidAccessModeRules[google.ima.OmidAccessMode.DOMAIN] =
omidValues.DOMAIN;
}
if (omidValues.LIMITED) {
adsRequest.omidAccessModeRules[google.ima.OmidAccessMode.LIMITED] =
omidValues.LIMITED;
}
}

adsRequest.linearAdSlotWidth = this.controller.getPlayerWidth();
adsRequest.linearAdSlotHeight = this.controller.getPlayerHeight();
adsRequest.nonLinearAdSlotWidth =
Expand Down

0 comments on commit 1e7ec7a

Please sign in to comment.