diff --git a/modules/pubmaticBidAdapter.js b/modules/pubmaticBidAdapter.js index e9ae90bdc50..4502dc66a65 100644 --- a/modules/pubmaticBidAdapter.js +++ b/modules/pubmaticBidAdapter.js @@ -1044,6 +1044,13 @@ export const spec = { newBid.meta.clickUrl = bid.adomain[0]; } + // adserverTargeting + if (seatbidder.ext && seatbidder.ext.buyid) { + newBid.adserverTargeting = { + 'hb_buyid_pubmatic': seatbidder.ext.buyid + }; + } + bidResponses.push(newBid); }); }); diff --git a/modules/pubmaticBidAdapter.md b/modules/pubmaticBidAdapter.md index 4a5d881a637..a045bed3e2b 100644 --- a/modules/pubmaticBidAdapter.md +++ b/modules/pubmaticBidAdapter.md @@ -202,5 +202,7 @@ pbjs.setConfig({ ``` Note: Combine the above the configuration with any other UserSync configuration. Multiple setConfig() calls overwrite each other and only last call for a given attribute will take effect. -Note: PubMatic will return a test-bid if "pubmaticTest=true" is present in page URL +# Notes: +- PubMatic will return a test-bid if "pubmaticTest=true" is present in page URL +- PubMatic will set bid.adserverTargeting.hb_buyid_pubmatic targeting key while submitting a bid into Prebid diff --git a/test/spec/modules/pubmaticBidAdapter_spec.js b/test/spec/modules/pubmaticBidAdapter_spec.js index d840d2527bd..817661ef51f 100644 --- a/test/spec/modules/pubmaticBidAdapter_spec.js +++ b/test/spec/modules/pubmaticBidAdapter_spec.js @@ -534,6 +534,9 @@ describe('PubMatic adapter', function () { 'id': '93D3BAD6-E2E2-49FB-9D89-920B1761C865', 'seatbid': [{ 'seat': 'seat-id', + 'ext': { + 'buyid': 'BUYER-ID-987' + }, 'bid': [{ 'id': '74858439-49D7-4169-BA5D-44A046315B2F', 'impid': '22bddb28db77d', @@ -549,6 +552,9 @@ describe('PubMatic adapter', function () { } }] }, { + 'ext': { + 'buyid': 'BUYER-ID-789' + }, 'bid': [{ 'id': '74858439-49D7-4169-BA5D-44A046315BEF', 'impid': '22bddb28db77e', @@ -2622,6 +2628,7 @@ describe('PubMatic adapter', function () { 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].adserverTargeting.hb_buyid_pubmatic).to.equal('BUYER-ID-987'); 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); @@ -2643,6 +2650,7 @@ describe('PubMatic adapter', function () { 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].adserverTargeting.hb_buyid_pubmatic).to.equal('BUYER-ID-789'); 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);