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

Rise Bid Adapter: support plcmt and sua #27

Merged
merged 4 commits into from
May 24, 2023
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
16 changes: 13 additions & 3 deletions modules/riseBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,16 @@ function generateBidParameters(bid, bidderRequest) {
bidObject.api = api;
}

const sua = deepAccess(bid, `ortb2.device.sua`);
if (sua) {
bidObject.sua = sua;
}

const coppa = deepAccess(bid, `ortb2.regs.coppa`)
if (coppa) {
bidObject.coppa = 1;
}

if (mediaType === VIDEO) {
const playbackMethod = deepAccess(bid, `mediaTypes.video.playbackmethod`);
let playbackMethodValue;
Expand Down Expand Up @@ -366,9 +376,9 @@ function generateBidParameters(bid, bidderRequest) {
bidObject.protocols = protocols;
}

const coppa = deepAccess(bid, 'ortb2.regs.coppa')
if (coppa) {
bidObject.coppa = 1;
const plcmt = deepAccess(bid, `mediaTypes.video.plcmt`);
if (plcmt) {
bidObject.plcmt = plcmt;
}
}

Expand Down
70 changes: 69 additions & 1 deletion test/spec/modules/riseBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ describe('riseAdapter', function () {
'mediaTypes': {
'video': {
'playerSize': [[640, 480]],
'context': 'instream'
'context': 'instream',
'plcmt': 1
}
},
'vastXml': '"<VAST version=\\\"2.0\\\">...</VAST>"'
Expand Down Expand Up @@ -116,6 +117,11 @@ describe('riseAdapter', function () {
expect(request.data.bids[0].placementId).to.equal(placementId);
});

it('sends the plcmt to ENDPOINT via POST', function () {
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.bids[0].plcmt).to.equal(1);
});

it('sends the is_wrapper parameter to ENDPOINT via POST', function() {
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.params).to.be.an('object');
Expand Down Expand Up @@ -342,6 +348,68 @@ describe('riseAdapter', function () {
expect(request.data.bids[0]).to.have.property('floorPrice', 1.5);
});

it('should check sua param in bid request', function() {
const sua = {
'platform': {
'brand': 'macOS',
'version': ['12', '4', '0']
},
'browsers': [
{
'brand': 'Chromium',
'version': [ '106', '0', '5249', '119' ]
},
{
'brand': 'Google Chrome',
'version': [ '106', '0', '5249', '119' ]
},
{
'brand': 'Not;A=Brand',
'version': [ '99', '0', '0', '0' ]
}
],
'mobile': 0,
'model': '',
'bitness': '64',
'architecture': 'x86'
}
const bid = utils.deepClone(bidRequests[0]);
bid.ortb2 = {
'device': {
'sua': {
'platform': {
'brand': 'macOS',
'version': [ '12', '4', '0' ]
},
'browsers': [
{
'brand': 'Chromium',
'version': [ '106', '0', '5249', '119' ]
},
{
'brand': 'Google Chrome',
'version': [ '106', '0', '5249', '119' ]
},
{
'brand': 'Not;A=Brand',
'version': [ '99', '0', '0', '0' ]
}
],
'mobile': 0,
'model': '',
'bitness': '64',
'architecture': 'x86'
}
}
}
const requestWithSua = spec.buildRequests([bid], bidderRequest);
const data = requestWithSua.data;
expect(data.bids[0].sua).to.exist;
expect(data.bids[0].sua).to.deep.equal(sua);
const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.bids[0].sua).to.not.exist;
});

describe('COPPA Param', function() {
it('should set coppa equal 0 in bid request if coppa is set to false', function() {
const request = spec.buildRequests(bidRequests, bidderRequest);
Expand Down