Skip to content

Commit

Permalink
Criteo Bid Adapter: Read GPP from ortb2 object (prebid#9775)
Browse files Browse the repository at this point in the history
Add support of GPP consent string when it is present in ortb2 object.
  • Loading branch information
dzhang-criteo authored and jorgeluisrocha committed May 18, 2023
1 parent 8eeb8cc commit 3d3b4be
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,9 @@ function buildCdbRequest(context, bidRequests, bidderRequest) {
ext: bidderRequest.publisherExt,
},
regs: {
coppa: bidderRequest.coppa === true ? 1 : (bidderRequest.coppa === false ? 0 : undefined)
coppa: bidderRequest.coppa === true ? 1 : (bidderRequest.coppa === false ? 0 : undefined),
gpp: bidderRequest.ortb2?.regs?.gpp,
gpp_sid: bidderRequest.ortb2?.regs?.gpp_sid
},
slots: bidRequests.map(bidRequest => {
networkId = bidRequest.params.networkId || networkId;
Expand Down
29 changes: 29 additions & 0 deletions test/spec/modules/criteoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,35 @@ describe('The Criteo bidding adapter', function () {
expect(request.data.user.uspIab).to.equal('1YNY');
});

it('should properly build a request with gpp consent field', function () {
const bidRequests = [
{
bidder: 'criteo',
adUnitCode: 'bid-123',
transactionId: 'transaction-123',
mediaTypes: {
banner: {
sizes: [[728, 90]]
}
},
params: {
zoneId: 123,
},
},
];
const ortb2 = {
regs: {
gpp: 'gpp_consent_string',
gpp_sid: [0, 1, 2]
}
};

const request = spec.buildRequests(bidRequests, { ...bidderRequest, ortb2 });
expect(request.data.regs).to.not.be.null;
expect(request.data.regs.gpp).to.equal('gpp_consent_string');
expect(request.data.regs.gpp_sid).to.deep.equal([0, 1, 2]);
});

it('should properly build a request with schain object', function () {
const expectedSchain = {
someProperty: 'someValue'
Expand Down

0 comments on commit 3d3b4be

Please sign in to comment.