Skip to content

Commit

Permalink
Criteo bid adapter: add fledge timeout and group limits (#11125)
Browse files Browse the repository at this point in the history
Set timeout to 50ms and 60 maximum interest groups per buyer
  • Loading branch information
dzhang-criteo authored Feb 24, 2024
1 parent f2eb49b commit d607309
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
14 changes: 14 additions & 0 deletions modules/criteoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,18 @@ export const spec = {
if (!sellerSignals.floor && bidRequest.params.bidFloor) {
sellerSignals.floor = bidRequest.params.bidFloor;
}
let perBuyerTimeout = { '*': 50 };
if (sellerSignals.perBuyerTimeout) {
for (const buyer in sellerSignals.perBuyerTimeout) {
perBuyerTimeout[buyer] = sellerSignals.perBuyerTimeout[buyer];
}
}
let perBuyerGroupLimits = { '*': 60 };
if (sellerSignals.perBuyerGroupLimits) {
for (const buyer in sellerSignals.perBuyerGroupLimits) {
perBuyerGroupLimits[buyer] = sellerSignals.perBuyerGroupLimits[buyer];
}
}
if (body?.ext?.sellerSignalsPerImp !== undefined) {
const sellerSignalsPerImp = body.ext.sellerSignalsPerImp[bidId];
if (sellerSignalsPerImp !== undefined) {
Expand All @@ -311,6 +323,8 @@ export const spec = {
sellerSignals,
sellerTimeout,
perBuyerSignals,
perBuyerTimeout,
perBuyerGroupLimits,
auctionSignals: {},
decisionLogicUrl: FLEDGE_DECISION_LOGIC_URL,
interestGroupBuyers: Object.keys(perBuyerSignals),
Expand Down
40 changes: 39 additions & 1 deletion test/spec/modules/criteoBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2572,6 +2572,8 @@ describe('The Criteo bidding adapter', function () {
sellerTimeout: 500,
sellerSignals: {
foo: 'bar',
perBuyerTimeout: { 'buyer1': 100, 'buyer2': 200 },
perBuyerGroupLimits: { 'buyer1': 300, 'buyer2': 400 },
},
sellerSignalsPerImp: {
'test-bidId': {
Expand Down Expand Up @@ -2641,15 +2643,33 @@ describe('The Criteo bidding adapter', function () {
foo: 'baz'
},
},
perBuyerTimeout: {
'*': 50,
'buyer1': 100,
'buyer2': 200
},
perBuyerGroupLimits: {
'*': 60,
'buyer1': 300,
'buyer2': 400
},
seller: 'https://seller-domain.com',
sellerTimeout: 500,
sellerSignals: {
foo: 'bar',
foo2: 'bar2',
floor: 1,
currency: 'USD',
perBuyerTimeout: {
'buyer1': 100,
'buyer2': 200
},
perBuyerGroupLimits: {
'buyer1': 300,
'buyer2': 400
},
},
sellerCurrency: 'USD'
sellerCurrency: 'USD',
},
});
expect(interpretedResponse.fledgeAuctionConfigs[1]).to.deep.equal({
Expand All @@ -2666,11 +2686,29 @@ describe('The Criteo bidding adapter', function () {
foo: 'baz'
},
},
perBuyerTimeout: {
'*': 50,
'buyer1': 100,
'buyer2': 200
},
perBuyerGroupLimits: {
'*': 60,
'buyer1': 300,
'buyer2': 400
},
seller: 'https://seller-domain.com',
sellerTimeout: 500,
sellerSignals: {
foo: 'bar',
floor: 1,
perBuyerTimeout: {
'buyer1': 100,
'buyer2': 200
},
perBuyerGroupLimits: {
'buyer1': 300,
'buyer2': 400
},
},
sellerCurrency: '???'
},
Expand Down

0 comments on commit d607309

Please sign in to comment.