From 1833be5b306753d0e8d79cc73afbdf3e15d5f263 Mon Sep 17 00:00:00 2001 From: Nick Peceniak Date: Thu, 11 Jun 2020 23:30:56 -0600 Subject: [PATCH] Add placement_type and position parameters to spotxBidAdapter (#5364) * Add min_duration and max_duration parameter to spotxBidAdapter * Add placement_type and position parameters to spotxBidAdapter Co-authored-by: Nick Peceniak --- modules/spotxBidAdapter.js | 8 ++++++++ test/spec/modules/spotxBidAdapter_spec.js | 20 ++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/modules/spotxBidAdapter.js b/modules/spotxBidAdapter.js index 515360d482e8..1733a176eba4 100644 --- a/modules/spotxBidAdapter.js +++ b/modules/spotxBidAdapter.js @@ -168,6 +168,14 @@ export const spec = { spotxReq.video.maxduration = utils.getBidIdParameter('max_duration', bid.params); } + if (utils.getBidIdParameter('placement_type', bid.params) != '') { + spotxReq.video.ext.placement = utils.getBidIdParameter('placement_type', bid.params); + } + + if (utils.getBidIdParameter('position', bid.params) != '') { + spotxReq.video.ext.pos = utils.getBidIdParameter('position', bid.params); + } + if (bid.crumbs && bid.crumbs.pubcid) { pubcid = bid.crumbs.pubcid; } diff --git a/test/spec/modules/spotxBidAdapter_spec.js b/test/spec/modules/spotxBidAdapter_spec.js index 56936dcfc62a..78d17f35c697 100644 --- a/test/spec/modules/spotxBidAdapter_spec.js +++ b/test/spec/modules/spotxBidAdapter_spec.js @@ -146,7 +146,9 @@ describe('the spotx adapter', function () { number_of_ads: 2, spotx_all_google_consent: 1, min_duration: 5, - max_duration: 10 + max_duration: 10, + placement_type: 1, + position: 1 }; bid.userId = { @@ -183,7 +185,9 @@ describe('the spotx adapter', function () { outstream_function: '987', custom: {bar: 'foo'}, sdk_name: 'Prebid 1+', - versionOrtb: '2.3' + versionOrtb: '2.3', + placement: 1, + pos: 1 }); expect(request.data.imp.video.startdelay).to.equal(1); @@ -315,6 +319,18 @@ describe('the spotx adapter', function () { expect(request.data.imp.video.minduration).to.equal(3); expect(request.data.imp.video.maxduration).to.equal(15); }); + + it('should pass placement_type and position params', function() { + var request; + + bid.params.placement_type = 2 + bid.params.position = 5 + + request = spec.buildRequests([bid], bidRequestObj)[0]; + + expect(request.data.imp.video.ext.placement).to.equal(2); + expect(request.data.imp.video.ext.pos).to.equal(5); + }); }); describe('interpretResponse', function() {