Skip to content

Commit a3d45fc

Browse files
smounitzjorgeluisrocha
authored andcommitted
Sovrn Bid Adapter: add gpp support (prebid#9811)
* feat: update Sovrn bid adapter to send gpp * style: eslint --------- Co-authored-by: feat: add video request fields <>
1 parent ac7d813 commit a3d45fc

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

modules/sovrnBidAdapter.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ export const spec = {
173173
if (bidderRequest.uspConsent) {
174174
deepSetValue(sovrnBidReq, 'regs.ext.us_privacy', bidderRequest.uspConsent);
175175
}
176+
if (bidderRequest.gppConsent) {
177+
deepSetValue(sovrnBidReq, 'regs.gpp', bidderRequest.gppConsent.gppString);
178+
deepSetValue(sovrnBidReq, 'regs.gpp_sid', bidderRequest.gppConsent.applicableSections);
179+
}
176180

177181
if (eids) {
178182
deepSetValue(sovrnBidReq, 'user.ext.eids', eids)

test/spec/modules/sovrnBidAdapter_spec.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,71 @@ describe('sovrnBidAdapter', function() {
248248
expect(data.regs.ext['us_privacy']).to.equal(bidderRequest.uspConsent)
249249
})
250250

251+
it('should send gpp info in OpenRTB 2.6 location when gppConsent defined', function () {
252+
const bidderRequest = {
253+
...baseBidderRequest,
254+
bidderCode: 'sovrn',
255+
auctionId: '1d1a030790a475',
256+
bidderRequestId: '22edbae2733bf6',
257+
timeout: 3000,
258+
gppConsent: {
259+
gppString: 'gppstring',
260+
applicableSections: [8]
261+
},
262+
bids: [baseBidRequest]
263+
}
264+
const { regs } = JSON.parse(spec.buildRequests([baseBidRequest], bidderRequest).data)
265+
expect(regs.gpp).to.equal('gppstring')
266+
expect(regs.gpp_sid).to.be.an('array')
267+
expect(regs.gpp_sid).to.include(8)
268+
})
269+
270+
it('should not send gpp info when gppConsent is not defined', function () {
271+
const bidderRequest = {
272+
...baseBidderRequest,
273+
bidderCode: 'sovrn',
274+
auctionId: '1d1a030790a475',
275+
bidderRequestId: '22edbae2733bf6',
276+
timeout: 3000,
277+
bids: [baseBidRequest],
278+
gdprConsent: {
279+
consentString: 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==',
280+
gdprApplies: true
281+
},
282+
}
283+
const { regs } = JSON.parse(spec.buildRequests([baseBidRequest], bidderRequest).data)
284+
expect(regs.gpp).to.be.undefined
285+
})
286+
287+
it('should send gdpr info even when gppConsent defined', function () {
288+
const bidderRequest = {
289+
...baseBidderRequest,
290+
bidderCode: 'sovrn',
291+
auctionId: '1d1a030790a475',
292+
bidderRequestId: '22edbae2733bf6',
293+
timeout: 3000,
294+
gdprConsent: {
295+
consentString: 'BOJ8RZsOJ8RZsABAB8AAAAAZ+A==',
296+
gdprApplies: true
297+
},
298+
gppConsent: {
299+
gppString: 'gppstring',
300+
applicableSections: [8]
301+
},
302+
bids: [baseBidRequest]
303+
}
304+
305+
const { regs, user } = JSON.parse(spec.buildRequests([baseBidRequest], bidderRequest).data)
306+
307+
expect(regs.ext.gdpr).to.exist.and.to.be.a('number')
308+
expect(regs.ext.gdpr).to.equal(1)
309+
expect(user.ext.consent).to.exist.and.to.be.a('string')
310+
expect(user.ext.consent).to.equal(bidderRequest.gdprConsent.consentString)
311+
expect(regs.gpp).to.equal('gppstring')
312+
expect(regs.gpp_sid).to.be.an('array')
313+
expect(regs.gpp_sid).to.include(8)
314+
})
315+
251316
it('should add schain if present', function() {
252317
const schainRequest = {
253318
...baseBidRequest,

0 commit comments

Comments
 (0)