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

Criteo Bid Adapter: add support for imp.rwdd #9964

Merged
merged 1 commit into from May 17, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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