From e400ec99f9c067a6d697d0a075d6bba624d57c1a Mon Sep 17 00:00:00 2001 From: Sachin Survase <60501281+sachin-pubmatic@users.noreply.github.com> Date: Fri, 30 Apr 2021 17:39:38 +0530 Subject: [PATCH] UOE-6240: Send gpt slot name in extension field (#151) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Tappx User Syncer + Site Update (#1674) Co-authored-by: ubuntu Co-authored-by: Albert Grandes * Beachfront Additional tests (#1679) * added place holder files for all but a couple of the intended new tests. I need to grok what those couple mean before being able to name a file. * This covers most of the suggested cases and a couple more that occured to me. I'll look at the couple that I held off on next. * added the unmarshal tests and found a couple problems to address in the process. * removed my __debug_bin. should be in gitignore. * A bit of clean up and commenting. Bumped version number. Added __debug_bin to .gitignore. This is the debugging binary created by Visual Studio Code, or at least version 1.52.1. * missed a bunch of version strings * removed IP faker * If IP is not included in an AdM request, an error is now thrown for the AdM imp instead of faking it. The AdM endpoint is the only one that requires an IP. Also, added several "no-ip" test cases. * Whent back to the fake IP solution instead of the error. Removed most of the "no-ip" test cases, leaving one. * changed ip in adm-video.json to not match the faker ip * removed a debugging comment * New Adapter: Onetag (#1695) * Pubmatic: Trimming publisher ID before passing (#1685) * Trimming publisher ID before passing * Fix typos in nobid.json (#1704) * Fix Typo In Adform Bidder Params (#1705) * Don't Load GVL v1 for TCF2 (+ TCF1 Cleanup) (#1693) * Typo fix for connectad bidder params (#1706) * Typo fix for invibes bidder params (#1707) * Typo fix nanointeractive bidder params (#1708) * Isolate /info/bidders Data Model + Add Uses HTTPS Flag (#1692) * Initial Commit * Merge Conflict Fixes * Removed Unncessary JSON Attributes * Removed Dev Notes * Add Missing validateDefaultAliases Test * Improved Reversed Test * Remove Var Scope Confusion * Proper Tests For Bidder Param Validator * Removed Unused Test Setup * New Adapter: Epom (#1680) Co-authored-by: Vasyl Zarva * New Adapter: Pangle (#1697) Co-authored-by: hcai * Fix Merge Conflict (#1714) * GumGum: adds pubId and irisid properties/parameters (#1664) * adds pubId and irisid properties * updates per naming convention & makes a video copy * updates when to copy banner, adds Publisher fallback and multiformat request * adds more json tests * rename the json file to remove whitespaces * Accommodate Apple iOS LMT bug (#1718) * New Adapter: jixie (#1698) * initial commit * added notes file for temp use * jixie adapter development work * jixie adaptor development work: mainly the test json files but also the jixie usersync code * added a test case with accountid. and cosmetic line changes in the banner*json test file * updated the jixie user sync: the endpoint and some params stuf * tks and fixing per comments on pull request 1698 * responding to guscarreon's comments: -more checking in makerequest of the bidder params (added 2 more test jsons) -removed blank lines, lines commented out -test_params: a case with unit alone -BadInput error * responding to review. put condition on jixie unit string in the bidder-params/jixie.json file. removed checking in jixie.go that has become unnecssary. removed unnec test cases. updated params-test * added one failed params test * removed a function that I no longer call! * renamed JixieAdapter to adapter * removed bidfloor from jixie explicit ext params * Fix Regs Nil Condition (#1723) * Mobfox: Add rout to adexcange (#1702) Co-authored-by: mobfox * New Adapter: TrustX (#1726) * New Adapter: UNICORN (#1719) * add bidder-info, bidder-params for UNICORN * Add adapter * Fixes GDPR bug about being overly strict on publisher restrictions (#1730) * 33Across: Updated exchange endpoint (#1738) * New Adapter: Adyoulike (#1700) Co-authored-by: Damien Dumas * Hoist GVL ID To Bidder Info (#1721) * Improve Digital adapter: add support for native ads (#1746) * Add Support For SkAdN + Refactor Split Imps (#1741) * No Longer Move bid.ext To bid.ext.bidder (#1742) * No Longer Move bid.ext To bid.ext.bidder * Remove Similar Behavior From seatbid.ext * Avoid Second Bid Copy * Removed Unused seatbid.ext * Typo fix: adyoulike bidder param debug description (#1755) * Aliases: Better Error Message For Disabled Bidder (#1751) * beachfront: Changes to support real 204 (#1737) * Fix race condition in 33across.go (#1757) Co-authored-by: Gus Carreon * Revert "Fix race condition in 33across.go (#1757)" (#1763) This reverts commit bdf1e7b3e13bdf87d3282bf74472fc66504537d5. * Replace TravisCI With GitHub Actions (#1754) * Initial Commit * Finished Configuration * Remove TravisCI * Remove TravisCI * Fix Go Version Badge * Correct Fix For Go Version Badge * Removed Custom Config File Name * Debug warnings (#1724) Co-authored-by: Veronika Solovei * Rubicon: Support sending segments to XAPI (#1752) Co-authored-by: Serhii Nahornyi * validateNativeContextTypes function test cases (#1743) * Applogy: Fix Shared Memory Overwriting (#1758) * Pubmatic: Fix Shared Memory Overwriting (#1759) * Beachfront: Fix Shared Memory Overwriting (#1762) * Fix race condition in Beachfront adapter * Removed nil check and simplified * FPD: Allow imp.ext.data To Passthrough To Adapters (#1765) * Smaato: Add support for app (#1767) Co-authored-by: Bernhard Pickenbrock * Update sync types (#1770) * 33across: Fix Shared Memory Overwriting (#1764) This reverts commit f7df258f061788ef7e72529115aa5fd554fa9f16. * Fix race condition in Yeahmobi adapter (#1761) Co-authored-by: Gus Carreon * Pubnative: Fix Shared Memory Overwriting (#1760) * Add request for registration (#1780) * Update OpenRTB Library (#1733) * Tappx changes - Backward compatible change of version (#1777) Co-authored-by: ubuntu Co-authored-by: Albert Grandes * DMX: Enforcing w and h in imp (#1778) Co-authored-by: steve-a-districtm * Remove Authorization Headers From Debug Response (#1779) * Hide Authorization Headers In Debug Response * MakeExtHeaders Tests * Add Empty Test * Use http.Header Methods * Updates From Code Review * Fix Merge Conflict * New Adapter: Bidmachine (#1769) * New Adapter: Criteo (#1775) * Fix shared memory issue when stripping authorization header from bid requests (#1790) * RTB House: update parameters (#1785) * update parameters required by RTB House adapter * tabs to spaces Co-authored-by: Przemyslaw Iwanczak * Generate seatbid[].bid[].ext.prebid.bidid (#1772) * Basic GDPR enforcement for specific publisher-vendors. (#1782) * New Adapter: Zemanta (#1774) * add zemanta adapter * update openrtb package for zemanta * fix loop iterator reference bug * fix getMediaTypeForImp to match server behavior * Zemanta: Rename Adapter To Outbrain (#1797) * Update openrtb library to v15 (#1802) * IX: Set bidVideo when category and duration is available (#1794) * Update IX defaults (#1799) Co-authored-by: Mike Burns * Update Adyoulike endpoint to hit production servers (#1805) * Openx: use bidfloor if set - prebid.js adapter behavior (#1795) * [ORBIDDER] add gvlVendorID and set bid response currency (#1798) * New Adapter: ADXCG (#1803) * Update kidoz properties to type string (#1808) Remove definitions object from schema and define types and other parameters directly in properties objects to ensure compatibility with more downstream systems that use this schema. * Update bidmachine properties to type string (#1809) Remove definitions object from schema and define types and other parameters directly in properties objects to ensure compatibility with more downstream systems that use this schema. * transform native eventtrackers to imptrackers and jstracker (#1811) * TheMediaGrid: Added processing of imp[].ext.data (#1807) * Renaming package github.com/PubMatic-OpenWrap/openrtb to github.com/mxmCherry/openrtb * Rename package github.com/PubMatic-OpenWrap/prebid-server to github.com/prebid/prebid-server * UOE-6196: OpenWrap S2S: Remove adpod_id from AppNexus adapter * Refactored code and fixed indentation * Fixed indentation for json files * Fixed indentation for json files * Fixed import in adapters/gumgum/gumgum.go * Reverted unwanted changes in test json files * Fixed unwanted git merge changes * Added missing field SkipDedup in ExtIncludeBrandCategory * Added missing Bidder field in ExtBid type * Exposing CookieSyncRequest for header-bidding * Temporary path change for static folder * Fixed static folder paths * Fixed default value in config for usersync_if_ambiguous * Fixed config after upgrade * Updated router.go to uncomment defaultRequest validation * Fixed path for accounts.filesystem.directorypath * Fixed diff with OW * Added DMX default usersync URL * Reverted Dmx default usersync url, Will add it in properties file * Added DMX usersync url * Adding changes missed for UOE-5114 during prebid-server upgrade * Adding changes missed for UOE-5114 during prebid-server upgrade * UOE-6240: Send gpt slot name in extension field Co-authored-by: prebidtappx <77485538+prebidtappx@users.noreply.github.com> Co-authored-by: ubuntu Co-authored-by: Albert Grandes Co-authored-by: Jim Naumann Co-authored-by: onetag-dev <38786435+onetag-dev@users.noreply.github.com> Co-authored-by: agilfix Co-authored-by: Scott Kay Co-authored-by: epomrnd Co-authored-by: Vasyl Zarva Co-authored-by: Hengsheng Cai Co-authored-by: hcai Co-authored-by: susyt Co-authored-by: jxdeveloper1 <71084096+jxdeveloper1@users.noreply.github.com> Co-authored-by: mobfxoHB <74364234+mobfxoHB@users.noreply.github.com> Co-authored-by: mobfox Co-authored-by: TheMediaGrid <44166371+TheMediaGrid@users.noreply.github.com> Co-authored-by: faithnh Co-authored-by: hhhjort <31041505+hhhjort@users.noreply.github.com> Co-authored-by: Aparna Rao Co-authored-by: guiann Co-authored-by: Damien Dumas Co-authored-by: Jozef Bartek <31618107+jbartek25@users.noreply.github.com> Co-authored-by: guscarreon Co-authored-by: Gus Carreon Co-authored-by: Veronika Solovei Co-authored-by: Veronika Solovei Co-authored-by: Serhii Nahornyi Co-authored-by: Serhii Nahornyi Co-authored-by: el-chuck Co-authored-by: Bernhard Pickenbrock Co-authored-by: Gena Co-authored-by: Gus Carreon Co-authored-by: bretg Co-authored-by: Steve Alliance Co-authored-by: steve-a-districtm Co-authored-by: Pavel Dunyashev Co-authored-by: Benjamin Co-authored-by: Brian Sardo <1168933+bsardo@users.noreply.github.com> Co-authored-by: Przemysław Iwańczak <36727380+piwanczak@users.noreply.github.com> Co-authored-by: Przemyslaw Iwanczak Co-authored-by: Rok Sušnik Co-authored-by: Rok Sušnik Co-authored-by: ixjohnny <75964135+ixjohnny@users.noreply.github.com> Co-authored-by: Michael Burns Co-authored-by: Mike Burns Co-authored-by: Laurentiu Badea Co-authored-by: Arne Schulz Co-authored-by: adxcgcom <31470944+adxcgcom@users.noreply.github.com> --- adapters/bidder.go | 3 +- adapters/pubmatic/pubmatic.go | 7 + .../supplemental/gptSlotNameInImpExt.json | 174 ++++++++++++++++++ openrtb_ext/imp.go | 9 + 4 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 adapters/pubmatic/pubmatictest/supplemental/gptSlotNameInImpExt.json 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"` +}