diff --git a/modules/criteoBidAdapter.js b/modules/criteoBidAdapter.js index edb718ec953..63c4482ab84 100644 --- a/modules/criteoBidAdapter.js +++ b/modules/criteoBidAdapter.js @@ -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); } diff --git a/test/spec/modules/criteoBidAdapter_spec.js b/test/spec/modules/criteoBidAdapter_spec.js index d88e70a6cdc..17527eb42c7 100755 --- a/test/spec/modules/criteoBidAdapter_spec.js +++ b/test/spec/modules/criteoBidAdapter_spec.js @@ -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 () {