Skip to content

Commit

Permalink
Add placement_type and position parameters to spotxBidAdapter (prebid…
Browse files Browse the repository at this point in the history
…#5364)

* Add min_duration and max_duration parameter to spotxBidAdapter

* Add placement_type and position parameters to spotxBidAdapter

Co-authored-by: Nick Peceniak <npeceniak@spotx.tv>
  • Loading branch information
2 people authored and iggyfisk committed Jun 22, 2020
1 parent 013b411 commit 54099aa
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
8 changes: 8 additions & 0 deletions modules/spotxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
20 changes: 18 additions & 2 deletions test/spec/modules/spotxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 54099aa

Please sign in to comment.