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

Add placement_type and position parameters to spotxBidAdapter #5364

Merged
merged 3 commits into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
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