Skip to content

Commit

Permalink
Criteo Bid Adapter: add support for imp.rwdd
Browse files Browse the repository at this point in the history
  • Loading branch information
Pgb-Criteo committed May 16, 2023
1 parent de22826 commit a09f4c7
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
Expand Up @@ -436,6 +436,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
Expand Up @@ -1487,6 +1487,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

1 comment on commit a09f4c7

@afewcc
Copy link
Contributor

@afewcc afewcc commented on a09f4c7 May 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Please sign in to comment.