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

Richaudience Bid Adapter : add compability with DSA #12099

Merged
merged 11 commits into from
Aug 8, 2024
9 changes: 8 additions & 1 deletion modules/richaudienceBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ export const spec = {
cpuc: (typeof window.navigator != 'undefined' ? window.navigator.hardwareConcurrency : null),
kws: getAllOrtbKeywords(bidderRequest.ortb2, bid.params.keywords).join(','),
schain: bid.schain,
gpid: raiSetPbAdSlot(bid)
gpid: raiSetPbAdSlot(bid),
dsa: setDSA(bid),
userData: deepAccess(bid, 'ortb2.user.data')
};

REFERER = (typeof bidderRequest.refererInfo.page != 'undefined' ? encodeURIComponent(bidderRequest.refererInfo.page) : null)
Expand Down Expand Up @@ -373,3 +375,8 @@ function raiGetTimeoutURL(data) {
}
return url
}

function setDSA(bid) {
let dsa = bid?.ortb2?.regs?.ext?.dsa ? bid?.ortb2?.regs?.ext?.dsa : null;
return dsa;
}
62 changes: 62 additions & 0 deletions test/spec/modules/richaudienceBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,53 @@ describe('Richaudience adapter tests', function () {
user: {}
}];

var DEFAULT_PARAMS_NEW_DSA = [{
adUnitCode: 'test-div',
bidId: '2c7c8e9c900244',
mediaTypes: {
banner: {
sizes: [
[300, 250], [300, 600], [728, 90], [970, 250]]
}
},
bidder: 'richaudience',
params: {
bidfloor: 0.5,
pid: 'ADb1f40rmi',
supplyType: 'site',
keywords: 'key1=value1;key2=value2'
},
auctionId: '0cb3144c-d084-4686-b0d6-f5dbe917c563',
bidRequestsCount: 1,
bidderRequestId: '1858b7382993ca',
ortb2: {
regs: {
ext: {
dsa: {
dsarequired: 2,
pubrender: 1,
datatopub: 1,
transparency: [
{
domain: 'richaudience.com',
dsaparams: [1, 3, 6]
},
{
domain: 'adpone.com',
dsaparams: [8, 10, 12]
},
{
domain: 'sunmedia.com',
dsaparams: [14, 16, 18]
}
]
}
}
}
},
user: {}
}];

var DEFAULT_PARAMS_NEW_SIZES_GPID = [{
adUnitCode: 'test-div',
bidId: '2c7c8e9c900244',
Expand Down Expand Up @@ -893,6 +940,21 @@ describe('Richaudience adapter tests', function () {
expect(requestContent).to.have.property('schain').to.deep.equal(schain);
})

it('should pass DSA', function() {
const request = spec.buildRequests(DEFAULT_PARAMS_NEW_DSA, {
gdprConsent: {
consentString: 'BOZcQl_ObPFjWAeABAESCD-AAAAjx7_______9______9uz_Ov_v_f__33e8__9v_l_7_-___u_-33d4-_1vf99yfm1-7ftr3tp_87ues2_Xur__59__3z3_NohBgA',
gdprApplies: true
},
refererInfo: {}
})
const requestContent = JSON.parse(request[0].data);
expect(requestContent).to.have.property('dsa').property('dsarequired').and.to.equal(2)
expect(requestContent).to.have.property('dsa').property('pubrender').and.to.equal(1);
expect(requestContent).to.have.property('dsa').property('datatopub').and.to.equal(1);
expect(requestContent.dsa.transparency[0]).to.have.property('domain').and.to.equal('richaudience.com');
})

it('should pass gpid', function() {
const request = spec.buildRequests(DEFAULT_PARAMS_NEW_SIZES_GPID, {
gdprConsent: {
Expand Down