Skip to content

Commit 892013b

Browse files
YakirLavinoamtzuberinoamtzuLaslo ChechurOronW
authored
Rise Bid Adapter: support sua and plcmt params. (prebid#9996)
* add Rise adapter * fixes * change param isOrg to org * Rise adapter * change email for rise * fix circle failed * bump * bump * bump * remove space * Upgrade Rise adapter to 5.0 * added isWrapper param * addes is_wrapper parameter to documentation * added is_wrapper to test * removed isWrapper * Rise Bid Adapter: support Coppa param (#24) * MinuteMedia Bid Adapter: support Coppa param (#25) * Revert "MinuteMedia Bid Adapter: support Coppa param (#25)" (#26) This reverts commit 66c4e7b. * bump * update coppa fetch * setting coppa param update * update Coppa tests * update test naming * Rise Bid Adapter: support plcmt and sua (#27) --------- Co-authored-by: Noam Tzuberi <[email protected]> Co-authored-by: noamtzu <[email protected]> Co-authored-by: Noam Tzuberi <[email protected]> Co-authored-by: Laslo Chechur <[email protected]> Co-authored-by: OronW <[email protected]> Co-authored-by: lasloche <[email protected]> Co-authored-by: inna <[email protected]> Co-authored-by: YakirLavi <[email protected]>
1 parent ce9c164 commit 892013b

File tree

2 files changed

+82
-4
lines changed

2 files changed

+82
-4
lines changed

modules/riseBidAdapter.js

+13-3
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,16 @@ function generateBidParameters(bid, bidderRequest) {
320320
bidObject.api = api;
321321
}
322322

323+
const sua = deepAccess(bid, `ortb2.device.sua`);
324+
if (sua) {
325+
bidObject.sua = sua;
326+
}
327+
328+
const coppa = deepAccess(bid, `ortb2.regs.coppa`)
329+
if (coppa) {
330+
bidObject.coppa = 1;
331+
}
332+
323333
if (mediaType === VIDEO) {
324334
const playbackMethod = deepAccess(bid, `mediaTypes.video.playbackmethod`);
325335
let playbackMethodValue;
@@ -366,9 +376,9 @@ function generateBidParameters(bid, bidderRequest) {
366376
bidObject.protocols = protocols;
367377
}
368378

369-
const coppa = deepAccess(bid, 'ortb2.regs.coppa')
370-
if (coppa) {
371-
bidObject.coppa = 1;
379+
const plcmt = deepAccess(bid, `mediaTypes.video.plcmt`);
380+
if (plcmt) {
381+
bidObject.plcmt = plcmt;
372382
}
373383
}
374384

test/spec/modules/riseBidAdapter_spec.js

+69-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ describe('riseAdapter', function () {
6262
'mediaTypes': {
6363
'video': {
6464
'playerSize': [[640, 480]],
65-
'context': 'instream'
65+
'context': 'instream',
66+
'plcmt': 1
6667
}
6768
},
6869
'vastXml': '"<VAST version=\\\"2.0\\\">...</VAST>"'
@@ -116,6 +117,11 @@ describe('riseAdapter', function () {
116117
expect(request.data.bids[0].placementId).to.equal(placementId);
117118
});
118119

120+
it('sends the plcmt to ENDPOINT via POST', function () {
121+
const request = spec.buildRequests(bidRequests, bidderRequest);
122+
expect(request.data.bids[0].plcmt).to.equal(1);
123+
});
124+
119125
it('sends the is_wrapper parameter to ENDPOINT via POST', function() {
120126
const request = spec.buildRequests(bidRequests, bidderRequest);
121127
expect(request.data.params).to.be.an('object');
@@ -342,6 +348,68 @@ describe('riseAdapter', function () {
342348
expect(request.data.bids[0]).to.have.property('floorPrice', 1.5);
343349
});
344350

351+
it('should check sua param in bid request', function() {
352+
const sua = {
353+
'platform': {
354+
'brand': 'macOS',
355+
'version': ['12', '4', '0']
356+
},
357+
'browsers': [
358+
{
359+
'brand': 'Chromium',
360+
'version': [ '106', '0', '5249', '119' ]
361+
},
362+
{
363+
'brand': 'Google Chrome',
364+
'version': [ '106', '0', '5249', '119' ]
365+
},
366+
{
367+
'brand': 'Not;A=Brand',
368+
'version': [ '99', '0', '0', '0' ]
369+
}
370+
],
371+
'mobile': 0,
372+
'model': '',
373+
'bitness': '64',
374+
'architecture': 'x86'
375+
}
376+
const bid = utils.deepClone(bidRequests[0]);
377+
bid.ortb2 = {
378+
'device': {
379+
'sua': {
380+
'platform': {
381+
'brand': 'macOS',
382+
'version': [ '12', '4', '0' ]
383+
},
384+
'browsers': [
385+
{
386+
'brand': 'Chromium',
387+
'version': [ '106', '0', '5249', '119' ]
388+
},
389+
{
390+
'brand': 'Google Chrome',
391+
'version': [ '106', '0', '5249', '119' ]
392+
},
393+
{
394+
'brand': 'Not;A=Brand',
395+
'version': [ '99', '0', '0', '0' ]
396+
}
397+
],
398+
'mobile': 0,
399+
'model': '',
400+
'bitness': '64',
401+
'architecture': 'x86'
402+
}
403+
}
404+
}
405+
const requestWithSua = spec.buildRequests([bid], bidderRequest);
406+
const data = requestWithSua.data;
407+
expect(data.bids[0].sua).to.exist;
408+
expect(data.bids[0].sua).to.deep.equal(sua);
409+
const request = spec.buildRequests(bidRequests, bidderRequest);
410+
expect(request.data.bids[0].sua).to.not.exist;
411+
});
412+
345413
describe('COPPA Param', function() {
346414
it('should set coppa equal 0 in bid request if coppa is set to false', function() {
347415
const request = spec.buildRequests(bidRequests, bidderRequest);

0 commit comments

Comments
 (0)