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

DeepIntent Bid Adapter : add gpp and coppa compliance support #11239

Merged
merged 14 commits into from
Mar 27, 2024
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
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);
});
});
});