Skip to content

Commit a8f7600

Browse files
npeceniakNick Peceniak
authored andcommitted
Add min_duration and max_duration parameter to spotxBidAdapter (prebid#5286)
Co-authored-by: Nick Peceniak <[email protected]>
1 parent a45a9b9 commit a8f7600

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

modules/spotxBidAdapter.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ export const spec = {
161161
spotxReq.video.startdelay = 0 + Boolean(utils.getBidIdParameter('start_delay', bid.params));
162162
}
163163

164+
if (utils.getBidIdParameter('min_duration', bid.params) != '') {
165+
spotxReq.video.minduration = utils.getBidIdParameter('min_duration', bid.params);
166+
}
167+
168+
if (utils.getBidIdParameter('max_duration', bid.params) != '') {
169+
spotxReq.video.maxduration = utils.getBidIdParameter('max_duration', bid.params);
170+
}
171+
164172
if (bid.crumbs && bid.crumbs.pubcid) {
165173
pubcid = bid.crumbs.pubcid;
166174
}

test/spec/modules/spotxBidAdapter_spec.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ describe('the spotx adapter', function () {
144144
price_floor: 123,
145145
start_delay: true,
146146
number_of_ads: 2,
147-
spotx_all_google_consent: 1
147+
spotx_all_google_consent: 1,
148+
min_duration: 5,
149+
max_duration: 10
148150
};
149151

150152
bid.userId = {
@@ -169,6 +171,10 @@ describe('the spotx adapter', function () {
169171

170172
request = spec.buildRequests([bid], bidRequestObj)[0];
171173
expect(request.data.id).to.equal(54321);
174+
expect(request.data.imp.video).to.contain({
175+
minduration: 5,
176+
maxduration: 10
177+
})
172178
expect(request.data.imp.video.ext).to.deep.equal({
173179
ad_volume: 1,
174180
hide_skin: 1,
@@ -297,6 +303,18 @@ describe('the spotx adapter', function () {
297303
expect(request.data.user.ext.consent).to.equal('consent123');
298304
expect(request.data.regs.ext.us_privacy).to.equal('1YYY');
299305
});
306+
307+
it('should pass min and max duration params', function() {
308+
var request;
309+
310+
bid.params.min_duration = 3
311+
bid.params.max_duration = 15
312+
313+
request = spec.buildRequests([bid], bidRequestObj)[0];
314+
315+
expect(request.data.imp.video.minduration).to.equal(3);
316+
expect(request.data.imp.video.maxduration).to.equal(15);
317+
});
300318
});
301319

302320
describe('interpretResponse', function() {

0 commit comments

Comments
 (0)