Skip to content

Commit

Permalink
consumable adapter: add gpp support (prebid#2883)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpiros authored and Peiling-Ding committed Jul 14, 2023
1 parent c3db838 commit bfb4005
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 1 deletion.
10 changes: 10 additions & 0 deletions adapters/consumable/consumable.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ type bidRequest struct {
Coppa bool `json:"coppa,omitempty"`
SChain openrtb2.SupplyChain `json:"schain"`
Content *openrtb2.Content `json:"content,omitempty"`
GPP string `json:"gpp,omitempty"`
GPPSID []int8 `json:"gpp_sid,omitempty"`
}

type placement struct {
Expand Down Expand Up @@ -192,6 +194,14 @@ func (a *ConsumableAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *

body.Coppa = request.Regs != nil && request.Regs.COPPA > 0

if request.Regs != nil && request.Regs.GPP != "" {
body.GPP = request.Regs.GPP
}

if request.Regs != nil && request.Regs.GPPSID != nil {
body.GPPSID = request.Regs.GPPSID
}

if request.Site != nil && request.Site.Content != nil {
body.Content = request.Site.Content
} else if request.App != nil && request.App.Content != nil {
Expand Down
130 changes: 130 additions & 0 deletions adapters/consumable/consumable/supplemental/simple-banner-gpp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"mockBidRequest": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"banner": {
"format": [{"w": 728, "h": 250}]
},
"ext": {
"bidder": {
"networkId": 11,
"siteId": 32,
"unitId": 42
}
}
}
],
"device": {
"ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36",
"ip": "123.123.123.123"
},
"site": {
"domain": "www.some.com",
"page": "http://www.some.com/page-where-ad-will-be-shown"
},
"regs": {
"gpp": "gppString",
"gpp_sid": [7]
}
},
"httpCalls": [
{
"expectedRequest": {
"uri": "https://e.serverbid.com/api/v2",
"headers": {
"Accept": [
"application/json"
],
"Content-Type": [
"application/json"
],
"User-Agent": [
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36"
],
"X-Forwarded-For": [
"123.123.123.123"
],
"Forwarded": [
"for=123.123.123.123"
],
"Origin": [
"http://www.some.com"
],
"Referer": [
"http://www.some.com/page-where-ad-will-be-shown"
]
},
"body": {
"placements": [
{
"adTypes": [2730],
"divName": "test-imp-id",
"networkId": 11,
"siteId": 32,
"unitId": 42
}
],
"schain": {
"complete": 0,
"nodes": null,
"ver": ""
},
"networkId": 11,
"siteId": 32,
"unitId": 42,
"time": 1451651415,
"url": "http://www.some.com/page-where-ad-will-be-shown",
"includePricingData": true,
"user":{},
"enableBotFiltering": true,
"parallel": true,
"gpp": "gppString",
"gpp_sid": [7]
}
},
"mockResponse": {
"status": 200,
"body": {
"decisions": {
"test-imp-id": {
"adId": 1234567890,
"pricing": {
"clearPrice": 0.5
},
"width": 728,
"height": 250,
"impressionUrl": "http://localhost:8080/shown",
"contents" : [
{
"body": "<blink>Remember this: https://www.google.com/search?q=blink+tag ?</blink>"
}
]
}
}
}
}
}
],
"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "test-request-id",
"impid": "test-imp-id",
"price": 0.5,
"adm": "<blink>Remember this: https://www.google.com/search?q=blink+tag ?</blink>",
"crid": "1234567890",
"exp": 30,
"w": 728,
"h": 250
},
"type": "banner"
}
]
}
]
}
4 changes: 3 additions & 1 deletion static/bidder-info/consumable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ capabilities:
- banner
userSync:
redirect:
url: "https://e.serverbid.com/udb/9969/match?gdpr={{.GDPR}}&euconsent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redir={{.RedirectURL}}"
url: "https://e.serverbid.com/udb/9969/match?gdpr={{.GDPR}}&euconsent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&gpp={{.GPP}}&gpp_sid={{.GPPSID}}&redir={{.RedirectURL}}"
userMacro: ""
# consumable appends the user id to end of the redirect url and does not utilize a macro
openrtb:
gpp-supported: true

0 comments on commit bfb4005

Please sign in to comment.