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

ORTB2: don't rely on context to infer video.placement #11719

Merged
merged 19 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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
10 changes: 5 additions & 5 deletions libraries/ortbConverter/processors/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const ORTB_VIDEO_PARAMS = new Set([
'playbackend'
]);

const PLACEMENT = {
'instream': 1,
const PLCMT = {
'outstream': 4,
}

export function fillVideoImp(imp, bidRequest, context) {
Expand All @@ -46,9 +46,9 @@ export function fillVideoImp(imp, bidRequest, context) {
}
Object.assign(video, format[0]);
}
const placement = PLACEMENT[videoParams.context];
if (placement != null) {
video.placement = placement;
const plcmt = PLCMT[videoParams.context];
if (plcmt != null) {
video.plcmt = plcmt;
}
imp.video = mergeDeep(video, imp.video);
}
Expand Down
14 changes: 13 additions & 1 deletion libraries/video/constants/ortb.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
* @property {number} w - Width of the video player in device independent pixels (DIPS).
* @property {number} h - Height of the video player in device independent pixels (DIPS).
* @property {number|undefined} startdelay - Indicates the offset of the ad placement.
* @property {number|undefined} placement - Placement type for the impression.
* @property {number|undefined} placement - Legacy Placement type for the impression.
* @property {number|undefined} plcmt - Modern placement type for the impression.
* @property {number|undefined} linearity - Indicates if the impression must be linear, nonlinear, etc. If omitted, assume all are allowed.
* @property {number} skip - Indicates if the player can allow the video to be skipped, where 0 is no, 1 is yes.
* @property {number|undefined} skipmin - Only ad creatives with a duration greater than this value can be skippable; only applicable if the ad is skippable.
Expand Down Expand Up @@ -97,6 +98,17 @@ export const PLACEMENT = {
INTERSTITIAL_SLIDER_FLOATING: 5
};

/**
* ADCOM - https://github.com/InteractiveAdvertisingBureau/AdCOM/blob/develop/AdCOM%20v1.0%20FINAL.md#list_plcmtsubtypesvideo
* @enum OrtbVideoParams.plcmt
*/
export const PLCMT = {
INSTREAM: 1,
ACCOMPANYING_CONTENT: 2,
INTERSTITIAL: 3,
NO_CONTENT: 4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

};

/**
* ORTB 2.5 section 5.4 - Ad Position
* @enum OrtbVideoParams.pos
Expand Down
8 changes: 2 additions & 6 deletions modules/ixBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { config } from '../src/config.js';
import { getStorageManager } from '../src/storageManager.js';
import { find } from '../src/polyfill.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { INSTREAM, OUTSTREAM } from '../src/video.js';
import { OUTSTREAM } from '../src/video.js';
import { Renderer } from '../src/Renderer.js';
import {getGptSlotInfoForAdUnitCode} from '../libraries/gptUtils/gptUtils.js';

Expand Down Expand Up @@ -258,17 +258,13 @@ export function bidToVideoImp(bid) {

// if placement not already defined, pick one based on `context`
if (context && !imp.video.hasOwnProperty('placement')) {
if (context === INSTREAM) {
imp.video.placement = 1;
karimMourra marked this conversation as resolved.
Show resolved Hide resolved
} else if (context === OUTSTREAM) {
if (context === OUTSTREAM) {
if (deepAccess(videoParamRef, 'playerConfig.floatOnScroll')) {
imp.video.placement = 5;
} else {
imp.video.placement = 3;
defaultVideoPlacement = true;
}
} else {
logWarn(`IX Bid Adapter: Video context '${context}' is not supported`);
}
}

Expand Down
5 changes: 0 additions & 5 deletions modules/jwplayerVideoProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -656,11 +656,6 @@ export const utils = {
* @return {PLACEMENT|OrtbVideoParams.placement|undefined}
*/
getPlacement: function(adConfig, player) {
if (!adConfig.outstream) {
// https://developer.jwplayer.com/jwplayer/docs/jw8-embed-an-outstream-player for more info on outstream
return PLACEMENT.INSTREAM;
}

if (player.getFloating()) {
return PLACEMENT.FLOATING;
}
Expand Down
7 changes: 2 additions & 5 deletions modules/videojsVideoProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '../libraries/video/constants/events.js';
// missing events: , AD_BREAK_START, , AD_BREAK_END, VIEWABLE, BUFFER, CAST, PLAYLIST_COMPLETE, RENDITION_UPDATE, PLAY_ATTEMPT_FAILED, AUTOSTART_BLOCKED
import {
PROTOCOLS, API_FRAMEWORKS, VIDEO_MIME_TYPE, PLAYBACK_METHODS, PLACEMENT, VPAID_MIME_TYPE, AD_POSITION, PLAYBACK_END
PROTOCOLS, API_FRAMEWORKS, VIDEO_MIME_TYPE, PLAYBACK_METHODS, VPAID_MIME_TYPE, AD_POSITION, PLAYBACK_END
} from '../libraries/video/constants/ortb.js';
import { VIDEO_JS_VENDOR } from '../libraries/video/constants/vendorCodes.js';
import { submodule } from '../src/hook.js';
Expand Down Expand Up @@ -146,10 +146,7 @@ export function VideojsProvider(providerConfig, vjs_, adState_, timeState_, call
// ~ Sort of resolved check if the player has a source to tell if the placement is instream
// Still cannot reliably check what type of placement the player is if its outstream
// i.e. we can't tell if its interstitial, in article, etc.
if (player.src()) {
video.placement = PLACEMENT.INSTREAM;
patmmccann marked this conversation as resolved.
Show resolved Hide resolved
karimMourra marked this conversation as resolved.
Show resolved Hide resolved
}

// update: cannot infer instream ever, always need declarations
// Placement according to IQG Guidelines 4.2.8
// https://cdn2.hubspot.net/hubfs/2848641/TrustworthyAccountabilityGroup_May2017/Docs/TAG-Inventory-Quality-Guidelines-v2_2-10-18-2016.pdf?t=1509469105938
const findPosition = vjs.dom.findPosition;
Expand Down