Skip to content

Commit

Permalink
Criteo Bid Adapter: Map device sua field to user ext sua (prebid#9809)
Browse files Browse the repository at this point in the history
Co-authored-by: v.raybaud <v.raybaud@criteo.com>
  • Loading branch information
2 people authored and jorgeluisrocha committed May 18, 2023
1 parent 453ebc0 commit 6dbe0d8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,10 @@ function buildCdbRequest(context, bidRequests, bidderRequest) {
if (bidderRequest && bidderRequest.uspConsent) {
request.user.uspIab = bidderRequest.uspConsent;
}
if (bidderRequest && bidderRequest.ortb2?.device?.sua) {
request.user.ext = request.user.ext || {};
request.user.ext.sua = bidderRequest.ortb2?.device?.sua || {};
}
return request;
}

Expand Down
32 changes: 32 additions & 0 deletions test/spec/modules/criteoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,38 @@ describe('The Criteo bidding adapter', function () {
expect(request.data.user.uspIab).to.equal('1YNY');
});

it('should properly build a request with device sua field', function () {
const sua = {}
const bidRequests = [
{
bidder: 'criteo',
adUnitCode: 'bid-123',
transactionId: 'transaction-123',
mediaTypes: {
banner: {
sizes: [[728, 90]]
}
},
params: {
zoneId: 123,
},
},
];
const bidderRequest = {
timeout: 3000,
uspConsent: '1YNY',
ortb2: {
device: {
sua: sua
}
}
};

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

it('should properly build a request with gpp consent field', function () {
const bidRequests = [
{
Expand Down

0 comments on commit 6dbe0d8

Please sign in to comment.