Skip to content

Commit

Permalink
Criteo Bid Adapter: add support for imp.rwdd (#9964)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pgb-Criteo authored May 17, 2023
1 parent 92daa81 commit eeab092
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,11 @@ function buildCdbRequest(context, bidRequests, bidderRequest) {
if (deepAccess(bidRequest, 'ortb2Imp.ext')) {
slot.ext = bidRequest.ortb2Imp.ext;
}

if (deepAccess(bidRequest, 'ortb2Imp.rwdd')) {
slot.rwdd = bidRequest.ortb2Imp.rwdd;
}

if (bidRequest.params.ext) {
slot.ext = Object.assign({}, slot.ext, bidRequest.params.ext);
}
Expand Down
67 changes: 67 additions & 0 deletions test/spec/modules/criteoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,73 @@ describe('The Criteo bidding adapter', function () {
}
});
});

it('should properly build a request when imp.rwdd is present', function () {
const bidderRequest = {};
const bidRequests = [
{
bidder: 'criteo',
adUnitCode: 'bid-123',
transactionId: 'transaction-123',
mediaTypes: {
banner: {
sizes: [[728, 90]]
}
},
params: {
zoneId: 123,
ext: {
bidfloor: 0.75
}
},
ortb2Imp: {
rwdd: 1,
ext: {
data: {
someContextAttribute: 'abc'
}
}
}
},
];

const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.slots[0].rwdd).to.be.not.null;
expect(request.data.slots[0].rwdd).to.equal(1);
});

it('should properly build a request when imp.rwdd is false', function () {
const bidderRequest = {};
const bidRequests = [
{
bidder: 'criteo',
adUnitCode: 'bid-123',
transactionId: 'transaction-123',
mediaTypes: {
banner: {
sizes: [[728, 90]]
}
},
params: {
zoneId: 123,
ext: {
bidfloor: 0.75
}
},
ortb2Imp: {
rwdd: 0,
ext: {
data: {
someContextAttribute: 'abc'
}
}
}
},
];

const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.slots[0].rwdd).to.be.undefined;
});
});

describe('interpretResponse', function () {
Expand Down

0 comments on commit eeab092

Please sign in to comment.