Skip to content

Commit af3e7fa

Browse files
DeepIntent Bid Adapter : add gpp and coppa compliance support (prebid#11239)
* add gpp and coppa compliance checks and tests * update test case * resolve comments * read coppa as per updated docs * update test suite * update test suite
1 parent ec34fa4 commit af3e7fa

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

modules/deepintentBidAdapter.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,20 @@ export const spec = {
9898
deepSetValue(openRtbBidRequest, 'regs.ext.gdpr', (bidderRequest.gdprConsent.gdprApplies ? 1 : 0));
9999
}
100100

101+
// GPP Consent
102+
if (bidderRequest?.gppConsent?.gppString) {
103+
deepSetValue(openRtbBidRequest, 'regs.gpp', bidderRequest.gppConsent.gppString);
104+
deepSetValue(openRtbBidRequest, 'regs.gpp_sid', bidderRequest.gppConsent.applicableSections);
105+
} else if (bidderRequest?.ortb2?.regs?.gpp) {
106+
deepSetValue(openRtbBidRequest, 'regs.gpp', bidderRequest.ortb2.regs.gpp);
107+
deepSetValue(openRtbBidRequest, 'regs.gpp_sid', bidderRequest.ortb2.regs.gpp_sid);
108+
}
109+
110+
// coppa compliance
111+
if (bidderRequest?.ortb2?.regs?.coppa) {
112+
deepSetValue(openRtbBidRequest, 'regs.coppa', 1);
113+
}
114+
101115
injectEids(openRtbBidRequest, validBidRequests);
102116

103117
return {

test/spec/modules/deepintentBidAdapter_spec.js

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,5 +357,34 @@ describe('Deepintent adapter', function () {
357357
let response = spec.interpretResponse(invalidResponse, bRequest);
358358
expect(response[0].mediaType).to.equal(undefined);
359359
});
360-
})
360+
});
361+
describe('GPP and coppa', function() {
362+
it('Request params check with GPP Consent', function () {
363+
let bidderReq = {gppConsent: {gppString: 'gpp-string-test', applicableSections: [5]}};
364+
let bRequest = spec.buildRequests(request, bidderReq);
365+
let data = JSON.parse(bRequest.data);
366+
expect(data.regs.gpp).to.equal('gpp-string-test');
367+
expect(data.regs.gpp_sid[0]).to.equal(5);
368+
});
369+
it('Request params check with GPP Consent read from ortb2', function () {
370+
let bidderReq = {
371+
ortb2: {
372+
regs: {
373+
gpp: 'gpp-test-string',
374+
gpp_sid: [5]
375+
}
376+
}
377+
};
378+
let bRequest = spec.buildRequests(request, bidderReq);
379+
let data = JSON.parse(bRequest.data);
380+
expect(data.regs.gpp).to.equal('gpp-test-string');
381+
expect(data.regs.gpp_sid[0]).to.equal(5);
382+
});
383+
it('should include coppa flag in bid request if coppa is set to true', () => {
384+
let bidderReq = {ortb2: {regs: {coppa: 1}}};
385+
let bRequest = spec.buildRequests(request, bidderReq);
386+
let data = JSON.parse(bRequest.data);
387+
expect(data.regs.coppa).to.equal(1);
388+
});
389+
});
361390
});

0 commit comments

Comments
 (0)