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 of bcat/badv/bapp #10013

Merged
merged 1 commit into from
May 30, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,15 @@ function buildCdbRequest(context, bidRequests, bidderRequest) {
request.user.ext = request.user.ext || {};
request.user.ext.eids = [...userIdAsEids];
}
if (bidderRequest && bidderRequest.ortb2?.bcat) {
request.bcat = bidderRequest.ortb2.bcat;
}
if (bidderRequest && bidderRequest.ortb2?.badv) {
request.badv = bidderRequest.ortb2.badv;
}
if (bidderRequest && bidderRequest.ortb2?.bapp) {
request.bapp = bidderRequest.ortb2.bapp;
}
return request;
}

Expand Down
84 changes: 84 additions & 0 deletions test/spec/modules/criteoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,90 @@ describe('The Criteo bidding adapter', function () {
expect(request.data.source.ext.schain).to.equal(expectedSchain);
});

it('should properly build a request with bcat field', function () {
const bcat = [ 'IAB1', 'IAB2' ];
const bidRequests = [
{
bidder: 'criteo',
adUnitCode: 'bid-123',
transactionId: 'transaction-123',
mediaTypes: {
banner: {
sizes: [[728, 90]]
}
},
params: {
zoneId: 123,
},
},
];
const bidderRequest = {
ortb2: {
bcat
}
};

const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.bcat).to.not.be.null;
expect(request.data.bcat).to.equal(bcat);
});

it('should properly build a request with badv field', function () {
const badv = [ 'ford.com' ];
const bidRequests = [
{
bidder: 'criteo',
adUnitCode: 'bid-123',
transactionId: 'transaction-123',
mediaTypes: {
banner: {
sizes: [[728, 90]]
}
},
params: {
zoneId: 123,
},
},
];
const bidderRequest = {
ortb2: {
badv
}
};

const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.badv).to.not.be.null;
expect(request.data.badv).to.equal(badv);
});

it('should properly build a request with bapp field', function () {
const bapp = [ 'com.foo.mygame' ];
const bidRequests = [
{
bidder: 'criteo',
adUnitCode: 'bid-123',
transactionId: 'transaction-123',
mediaTypes: {
banner: {
sizes: [[728, 90]]
}
},
params: {
zoneId: 123,
},
},
];
const bidderRequest = {
ortb2: {
bapp
}
};

const request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.bapp).to.not.be.null;
expect(request.data.bapp).to.equal(bapp);
});

it('should properly build a request with if ccpa consent field is not provided', function () {
const bidRequests = [
{
Expand Down