Skip to content

Commit

Permalink
Add auctionId, PlayerName to PBS params
Browse files Browse the repository at this point in the history
  • Loading branch information
osazos committed Aug 17, 2021
1 parent 07ab54d commit c4344aa
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
22 changes: 17 additions & 5 deletions modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,16 @@ function isNewSession(adagioStorage) {
)
}

function setPlayerName(bidRequest) {
const playerName = (internal.isRendererPreferredFromPublisher(bidRequest)) ? 'other' : 'adagio';

if (playerName === 'other') {
utils.logWarn(`${LOG_PREFIX} renderer.backupOnly has not been set. Adagio recommends to use its own player to get expected behavior.`);
}

return playerName;
}

export const internal = {
enqueue,
getPageviewId,
Expand Down Expand Up @@ -414,11 +424,7 @@ function _buildVideoBidRequest(bidRequest) {
};

if (videoParams.context && videoParams.context === OUTSTREAM) {
bidRequest.mediaTypes.video.playerName = (internal.isRendererPreferredFromPublisher(bidRequest)) ? 'other' : 'adagio';

if (bidRequest.mediaTypes.video.playerName === 'other') {
utils.logWarn(`${LOG_PREFIX} renderer.backupOnly has not been set. Adagio recommends to use its own player to get expected behavior.`);
}
bidRequest.mediaTypes.video.playerName = setPlayerName(bidRequest);
}

// Only whitelisted OpenRTB options need to be validated.
Expand Down Expand Up @@ -1071,6 +1077,8 @@ export const spec = {
if (isOrtb) {
autoFillParams(adagioBid);

adagioBid.params.auctionId = utils.deepAccess(adagioBidderRequest, 'auctionId');

const globalFeatures = GlobalExchange.getOrSetGlobalFeatures();
adagioBid.params.features = {
...globalFeatures,
Expand All @@ -1082,6 +1090,10 @@ export const spec = {
adagioBid.params.prebidVersion = '$prebid.version$';
adagioBid.params.data = GlobalExchange.getExchangeData();

if (utils.deepAccess(adagioBid, 'mediaTypes.video.context') === OUTSTREAM) {
adagioBid.params.playerName = setPlayerName(adagioBid);
}

storeRequestInAdagioNS(adagioBid);
}

Expand Down
16 changes: 13 additions & 3 deletions test/spec/modules/adagioBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1151,14 +1151,24 @@ describe('Adagio bid adapter', () => {
};
const bid01 = new BidRequestBuilder({
'mediaTypes': {
banner: { sizes: [[300, 250]] }
banner: { sizes: [[300, 250]] },
video: {
context: 'outstream',
playerSize: [300, 250],
renderer: {
url: 'https://url.tld',
render: () => true
}
}
}
}).withParams().build();

const params = spec.transformBidParams({ organizationId: '1000' }, true, adUnit, [{ bidderCode: 'adagio', bids: [bid01] }]);
const params = spec.transformBidParams({ organizationId: '1000' }, true, adUnit, [{ bidderCode: 'adagio', auctionId: bid01.auctionId, bids: [bid01] }]);

expect(params.organizationId).to.exist;
expect(params.organizationId).to.exist;
expect(params.auctionId).to.exist;
expect(params.playerName).to.exist;
expect(params.playerName).to.equal('other');
expect(params.features).to.exist;
expect(params.features.page_dimensions).to.exist;
expect(params.features.adunit_position).to.exist;
Expand Down

0 comments on commit c4344aa

Please sign in to comment.