diff --git a/adapters/bidder.go b/adapters/bidder.go index 622be8212f5..2ac2271fc07 100644 --- a/adapters/bidder.go +++ b/adapters/bidder.go @@ -130,7 +130,8 @@ type ExtImpBidder struct { // // Bidder implementations may safely assume that this JSON has been validated by their // static/bidder-params/{bidder}.json file. - Bidder json.RawMessage `json:"bidder"` + Bidder json.RawMessage `json:"bidder"` + Data *openrtb_ext.ExtData `json:"data,omitempty"` } func (r *RequestData) SetBasicAuth(username string, password string) { diff --git a/adapters/pubmatic/pubmatic.go b/adapters/pubmatic/pubmatic.go index c9e3660b4c8..a0ca5f50529 100644 --- a/adapters/pubmatic/pubmatic.go +++ b/adapters/pubmatic/pubmatic.go @@ -28,6 +28,8 @@ const ( buyIdTargetingKey = "hb_buyid_pubmatic" skAdnetworkKey = "skadn" rewardKey = "reward" + ImpExtAdUnitKey = "dfp_ad_unit_code" + AdServerGAM = "gam" ) type PubmaticAdapter struct { @@ -631,6 +633,11 @@ func parseImpressionObject(imp *openrtb2.Imp, wrapExt *pubmaticWrapperExt, pubID } } + if bidderExt.Data != nil && bidderExt.Data.AdServer != nil && + bidderExt.Data.AdServer.Name == AdServerGAM && bidderExt.Data.AdServer.AdSlot != "" { + impExtMap[ImpExtAdUnitKey] = bidderExt.Data.AdServer.AdSlot + } + if len(impExtMap) != 0 { impExtBytes, err := json.Marshal(impExtMap) if err == nil { diff --git a/adapters/pubmatic/pubmatictest/supplemental/gptSlotNameInImpExt.json b/adapters/pubmatic/pubmatictest/supplemental/gptSlotNameInImpExt.json new file mode 100644 index 00000000000..9336ed63262 --- /dev/null +++ b/adapters/pubmatic/pubmatictest/supplemental/gptSlotNameInImpExt.json @@ -0,0 +1,174 @@ +{ + "mockBidRequest": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ] + }, + "ext": { + "bidder": { + "adSlot": "AdTag_Div1@300x250", + "publisherId": "999", + "keywords": [ + { + "key": "pmZoneID", + "value": [ + "Zone1", + "Zone2" + ] + }, + { + "key": "preference", + "value": [ + "sports", + "movies" + ] + } + ], + "wrapper": { + "version": 1, + "profile": 5123 + } + }, + "data": { + "adserver": { + "name": "gam", + "adslot": "/1111/home" + } + } + } + } + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" + }, + "site": { + "id": "siteID", + "publisher": { + "id": "1234" + } + }, + "ext": { + "prebid": { + "bidderparams": { + "wiid": "dwzafakjflan-tygannnvlla-mlljvj" + } + } + } + }, + "httpCalls": [ + { + "expectedRequest": { + "uri": "https://hbopenbid.pubmatic.com/translator?source=prebid-server", + "body": { + "id": "test-request-id", + "imp": [ + { + "id": "test-imp-id", + "tagid": "AdTag_Div1", + "banner": { + "format": [ + { + "w": 300, + "h": 250 + } + ], + "h": 250, + "w": 300 + }, + "ext": { + "pmZoneID": "Zone1,Zone2", + "preference": "sports,movies", + "dfp_ad_unit_code": "/1111/home" + } + } + ], + "device": { + "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" + }, + "site": { + "id": "siteID", + "publisher": { + "id": "999" + } + }, + "ext": { + "wrapper": { + "profile": 5123, + "version": 1, + "wiid": "dwzafakjflan-tygannnvlla-mlljvj" + } + } + } + }, + "mockResponse": { + "status": 200, + "body": { + "id": "test-request-id", + "seatbid": [ + { + "seat": "958", + "bid": [ + { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.500000, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "pubmatic.com" + ], + "crid": "29681110", + "h": 250, + "w": 300, + "dealid": "test deal", + "ext": { + "dspid": 6, + "deal_channel": 1 + } + } + ] + } + ], + "bidid": "5778926625248726496", + "cur": "USD" + } + } + } + ], + "expectedBidResponses": [ + { + "currency": "USD", + "bids": [ + { + "bid": { + "id": "7706636740145184841", + "impid": "test-imp-id", + "price": 0.5, + "adid": "29681110", + "adm": "some-test-ad", + "adomain": [ + "pubmatic.com" + ], + "crid": "29681110", + "w": 300, + "h": 250, + "dealid": "test deal", + "ext": { + "dspid": 6, + "deal_channel": 1 + } + }, + "type": "banner" + } + ] + } + ] +} diff --git a/openrtb_ext/imp.go b/openrtb_ext/imp.go index f83fa63df84..4a2c2bc5c77 100644 --- a/openrtb_ext/imp.go +++ b/openrtb_ext/imp.go @@ -22,3 +22,12 @@ type ExtImpPrebid struct { type ExtStoredRequest struct { ID string `json:"id"` } + +type ExtData struct { + AdServer *ExtAdServer `json:"adserver"` +} + +type ExtAdServer struct { + Name string `json:"name"` + AdSlot string `json:"adslot"` +}