Skip to content

Commit

Permalink
Criteo Bid Adapter: fix issue where bidder conf pubid param is not se…
Browse files Browse the repository at this point in the history
…nt in the proper field (prebid#11416)
  • Loading branch information
leonardlabat authored Apr 29, 2024
1 parent 7b77515 commit 428ae3b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
9 changes: 6 additions & 3 deletions modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,6 @@ function buildCdbRequest(context, bidRequests, bidderRequest) {
if (networkId) {
request.publisher.networkid = networkId;
}
if (pubid) {
request.publisher.id = pubid;
}

request.source = {
tid: bidderRequest.ortb2?.source?.tid
Expand All @@ -637,6 +634,12 @@ function buildCdbRequest(context, bidRequests, bidderRequest) {
request.user = bidderRequest.ortb2?.user || {};
request.site = bidderRequest.ortb2?.site || {};
request.app = bidderRequest.ortb2?.app || {};

if (pubid) {
request.site.publisher = {...request.site.publisher, ...{ id: pubid }};
request.app.publisher = {...request.app.publisher, ...{ id: pubid }};
}

request.device = bidderRequest.ortb2?.device || {};
if (bidderRequest && bidderRequest.ceh) {
request.user.ceh = bidderRequest.ceh;
Expand Down
13 changes: 11 additions & 2 deletions test/spec/modules/criteoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,15 @@ describe('The Criteo bidding adapter', function () {
});

it('should properly transmit the pubid and slot uid if available', function () {
const bidderRequest = {};
const bidderRequest = {
ortb2: {
site: {
publisher: {
id: 'pub-777'
}
}
}
};
const bidRequests = [
{
bidder: 'criteo',
Expand Down Expand Up @@ -2050,7 +2058,8 @@ describe('The Criteo bidding adapter', function () {
];
const request = spec.buildRequests(bidRequests, bidderRequest);
const ortbRequest = request.data;
expect(ortbRequest.publisher.id).to.equal('pub-888');
expect(ortbRequest.publisher.id).to.be.undefined;
expect(ortbRequest.site.publisher.id).to.equal('pub-888');
expect(request.data.slots[0].ext.bidder).to.be.undefined;
expect(request.data.slots[1].ext.bidder.uid).to.equal(888);
});
Expand Down

0 comments on commit 428ae3b

Please sign in to comment.