Skip to content

Commit

Permalink
DeepIntent Bid Adapter : add gpp and coppa compliance support (#11239)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
parthshah51999 authored Mar 27, 2024
1 parent ec34fa4 commit af3e7fa
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
14 changes: 14 additions & 0 deletions modules/deepintentBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ export const spec = {
deepSetValue(openRtbBidRequest, 'regs.ext.gdpr', (bidderRequest.gdprConsent.gdprApplies ? 1 : 0));
}

// GPP Consent
if (bidderRequest?.gppConsent?.gppString) {
deepSetValue(openRtbBidRequest, 'regs.gpp', bidderRequest.gppConsent.gppString);
deepSetValue(openRtbBidRequest, 'regs.gpp_sid', bidderRequest.gppConsent.applicableSections);
} else if (bidderRequest?.ortb2?.regs?.gpp) {
deepSetValue(openRtbBidRequest, 'regs.gpp', bidderRequest.ortb2.regs.gpp);
deepSetValue(openRtbBidRequest, 'regs.gpp_sid', bidderRequest.ortb2.regs.gpp_sid);
}

// coppa compliance
if (bidderRequest?.ortb2?.regs?.coppa) {
deepSetValue(openRtbBidRequest, 'regs.coppa', 1);
}

injectEids(openRtbBidRequest, validBidRequests);

return {
Expand Down
31 changes: 30 additions & 1 deletion test/spec/modules/deepintentBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,5 +357,34 @@ describe('Deepintent adapter', function () {
let response = spec.interpretResponse(invalidResponse, bRequest);
expect(response[0].mediaType).to.equal(undefined);
});
})
});
describe('GPP and coppa', function() {
it('Request params check with GPP Consent', function () {
let bidderReq = {gppConsent: {gppString: 'gpp-string-test', applicableSections: [5]}};
let bRequest = spec.buildRequests(request, bidderReq);
let data = JSON.parse(bRequest.data);
expect(data.regs.gpp).to.equal('gpp-string-test');
expect(data.regs.gpp_sid[0]).to.equal(5);
});
it('Request params check with GPP Consent read from ortb2', function () {
let bidderReq = {
ortb2: {
regs: {
gpp: 'gpp-test-string',
gpp_sid: [5]
}
}
};
let bRequest = spec.buildRequests(request, bidderReq);
let data = JSON.parse(bRequest.data);
expect(data.regs.gpp).to.equal('gpp-test-string');
expect(data.regs.gpp_sid[0]).to.equal(5);
});
it('should include coppa flag in bid request if coppa is set to true', () => {
let bidderReq = {ortb2: {regs: {coppa: 1}}};
let bRequest = spec.buildRequests(request, bidderReq);
let data = JSON.parse(bRequest.data);
expect(data.regs.coppa).to.equal(1);
});
});
});

0 comments on commit af3e7fa

Please sign in to comment.