Skip to content

Commit

Permalink
Pubmatic Bid Adapter : consuming fledge auction config in bid adapter (
Browse files Browse the repository at this point in the history
…#10506)

Changes in PubMatic bid adapter to consume auction config from server response and submit the same to Prebid core
  • Loading branch information
pm-nitin-nimbalkar authored Sep 20, 2023
1 parent e8b9aec commit 2213365
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
15 changes: 15 additions & 0 deletions modules/pubmaticBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,21 @@ export const spec = {
});
});
}
let fledgeAuctionConfigs = deepAccess(response.body, 'ext.fledge_auction_configs');
if (fledgeAuctionConfigs) {
fledgeAuctionConfigs = Object.entries(fledgeAuctionConfigs).map(([bidId, cfg]) => {
return {
bidId,
config: Object.assign({
auctionSignals: {},
}, cfg)
}
});
return {
bids: bidResponses,
fledgeAuctionConfigs,
}
}
} catch (error) {
logError(error);
}
Expand Down
83 changes: 83 additions & 0 deletions test/spec/modules/pubmaticBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3601,6 +3601,89 @@ describe('PubMatic adapter', function () {
}
});

describe('Fledge Auction config Response', function () {
let response;
let bidRequestConfigs = [
{
bidder: 'pubmatic',
mediaTypes: {
banner: {
sizes: [[728, 90], [160, 600]]
}
},
params: {
publisherId: '5670',
adSlot: '/15671365/DMDemo@300x250:0',
kadfloor: '1.2',
pmzoneid: 'aabc, ddef',
kadpageurl: 'www.publisher.com',
yob: '1986',
gender: 'M',
lat: '12.3',
lon: '23.7',
wiid: '1234567890',
profId: '100',
verId: '200',
currency: 'AUD',
dctr: 'key1:val1,val2|key2:val1'
},
placementCode: '/19968336/header-bid-tag-1',
sizes: [[300, 250], [300, 600]],
bidId: 'test_bid_id',
requestId: '0fb4905b-9456-4152-86be-c6f6d259ba99',
bidderRequestId: '1c56ad30b9b8ca8',
ortb2Imp: {
ext: {
tid: '92489f71-1bf2-49a0-adf9-000cea934729',
ae: 1
}
},
}
];

let bidRequest = spec.buildRequests(bidRequestConfigs, {});
let bidResponse = {
seatbid: [{
bid: [{
impid: 'test_bid_id',
price: 2,
w: 728,
h: 250,
crid: 'test-creative-id',
dealid: 'test-deal-id',
adm: 'test-ad-markup'
}]
}],
cur: 'AUS',
ext: {
fledge_auction_configs: {
'test_bid_id': {
seller: 'ads.pubmatic.com',
interestGroupBuyers: ['dsp1.com'],
sellerTimeout: 0,
perBuyerSignals: {
'dsp1.com': {
bid_macros: 0.1,
disallowed_adv_ids: [
'5678',
'5890'
],
}
}
}
}
}
};

response = spec.interpretResponse({ body: bidResponse }, bidRequest);
it('should return FLEDGE auction_configs alongside bids', function () {
expect(response).to.have.property('bids');
expect(response).to.have.property('fledgeAuctionConfigs');
expect(response.fledgeAuctionConfigs.length).to.equal(1);
expect(response.fledgeAuctionConfigs[0].bidId).to.equal('test_bid_id');
});
});

describe('Preapare metadata', function () {
it('Should copy all fields from ext to meta', function () {
const bid = {
Expand Down

0 comments on commit 2213365

Please sign in to comment.