Skip to content

Commit

Permalink
Add buyer data to Pubmatic bid responses (prebid#3619)
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvin-chappell authored and pycnvr committed Apr 4, 2019
1 parent 9ecbe74 commit 337015e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
11 changes: 11 additions & 0 deletions modules/pubmaticBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,17 @@ export const spec = {
newBid['dealChannel'] = dealChannelValues[bid.ext.deal_channel] || null;
}

newBid.meta = {};
if (bid.ext && bid.ext.dspid) {
newBid.meta.networkId = bid.ext.dspid;
}
if (bid.ext && bid.ext.advid) {
newBid.meta.buyerId = bid.ext.advid;
}
if (bid.adomain && bid.adomain.length > 0) {
newBid.meta.clickUrl = bid.adomain[0];
}

bidResponses.push(newBid);
});
});
Expand Down
16 changes: 14 additions & 2 deletions test/spec/modules/pubmaticBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,13 @@ describe('PubMatic adapter', function () {
'impid': '22bddb28db77d',
'price': 1.3,
'adm': 'image3.pubmatic.com Layer based creative',
'adomain': ['blackrock.com'],
'h': 250,
'w': 300,
'ext': {
'deal_channel': 6
'deal_channel': 6,
'advid': 976,
'dspid': 123
}
}]
}, {
Expand All @@ -293,10 +296,13 @@ describe('PubMatic adapter', function () {
'impid': '22bddb28db77e',
'price': 1.7,
'adm': 'image3.pubmatic.com Layer based creative',
'adomain': ['hivehome.com'],
'h': 250,
'w': 300,
'ext': {
'deal_channel': 5
'deal_channel': 5,
'advid': 832,
'dspid': 422
}
}]
}]
Expand Down Expand Up @@ -1323,6 +1329,9 @@ describe('PubMatic adapter', function () {
expect(response[0].currency).to.equal('USD');
expect(response[0].netRevenue).to.equal(false);
expect(response[0].ttl).to.equal(300);
expect(response[0].meta.networkId).to.equal(123);
expect(response[0].meta.buyerId).to.equal(976);
expect(response[0].meta.clickUrl).to.equal('blackrock.com');
expect(response[0].referrer).to.include(data.site.ref);
expect(response[0].ad).to.equal(bidResponses.body.seatbid[0].bid[0].adm);

Expand All @@ -1339,6 +1348,9 @@ describe('PubMatic adapter', function () {
expect(response[1].currency).to.equal('USD');
expect(response[1].netRevenue).to.equal(false);
expect(response[1].ttl).to.equal(300);
expect(response[1].meta.networkId).to.equal(422);
expect(response[1].meta.buyerId).to.equal(832);
expect(response[1].meta.clickUrl).to.equal('hivehome.com');
expect(response[1].referrer).to.include(data.site.ref);
expect(response[1].ad).to.equal(bidResponses.body.seatbid[1].bid[0].adm);
});
Expand Down

0 comments on commit 337015e

Please sign in to comment.