Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

Commit

Permalink
OpenX adapter: pass optional platform (PBID-598) (prebid#1421)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurb9 authored Jul 30, 2020
1 parent 1f39eda commit baba031
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
4 changes: 3 additions & 1 deletion adapters/openx/openx.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ type openxImpExt struct {
}

type openxReqExt struct {
DelDomain string `json:"delDomain"`
DelDomain string `json:"delDomain,omitempty"`
Platform string `json:"platform,omitempty"`
BidderConfig string `json:"bc"`
}

Expand Down Expand Up @@ -125,6 +126,7 @@ func preprocess(imp *openrtb.Imp, reqExt *openxReqExt) error {
}

reqExt.DelDomain = openxExt.DelDomain
reqExt.Platform = openxExt.Platform

imp.TagID = openxExt.Unit
imp.BidFloor = openxExt.CustomFloor
Expand Down
4 changes: 3 additions & 1 deletion adapters/openx/openxtest/exemplary/optional-params.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"bidder": {
"unit": "539439964",
"delDomain": "se-demo-d.openx.net",
"platform": "PLATFORM",
"customFloor": 0.1,
"customParams": {"foo": "bar"}
}
Expand Down Expand Up @@ -40,7 +41,8 @@
],
"ext": {
"bc": "hb_pbs_1.0.0",
"delDomain": "se-demo-d.openx.net"
"delDomain": "se-demo-d.openx.net",
"platform": "PLATFORM"
}
}
},
Expand Down
7 changes: 5 additions & 2 deletions docs/bidders/openx.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ OpenX supports the following parameters:
| property | type | required? | description | example |
|----------|------|-----------|-------------|---------|
| unit | string | required | The ad unit id | "10092842" |
| delDomain | string | required | The delivery domain for the customer | "sademo-d.openx.net" |
| delDomain | string | required\* | The delivery domain for the customer | "sademo-d.openx.net" |
| platform | uuid | required\* | The platform id for the customer | "a3aece0c-9e80-4316-8deb-faf804779bd1" |
| customFloor | number | optional | The minimum CPM price in USD | 1.50 - sets a $1.50 floor |
| customParams | object | optional | User-defined targeting key-value pairs | {key1: "v1", key2: ["v2","v3"]} |

\* At least one of `delDomain` or `platform` parameters is required.

If you have any questions regarding setting up, please reach out to your account manager or
<support@openx.com>

Expand Down Expand Up @@ -59,4 +62,4 @@ If you have any questions regarding setting up, please reach out to your account
},
}
}
```
```
1 change: 1 addition & 0 deletions openrtb_ext/imp_openx.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package openrtb_ext
// ExtImpOpenx defines the contract for bidrequest.imp[i].ext.openx
type ExtImpOpenx struct {
Unit string `json:"unit"`
Platform string `json:"platform"`
DelDomain string `json:"delDomain"`
CustomFloor float64 `json:"customFloor"`
CustomParams map[string]interface{} `json:"customParams"`
Expand Down
22 changes: 20 additions & 2 deletions static/bidder-params/openx.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
"pattern": "\\.[a-zA-Z]{2,3}$",
"format": "hostname"
},
"platform": {
"type": "string",
"description": "The platform id for the customer.",
"format": "uuid"
},
"customFloor": {
"type": "number",
"description": "The minimum CPM price in USD.",
Expand All @@ -26,6 +31,19 @@
"description": "User-defined targeting key-value pairs."
}
},

"required": ["unit", "delDomain"]
"required": [
"unit"
],
"anyOf": [
{
"required": [
"delDomain"
]
},
{
"required": [
"platform"
]
}
]
}

0 comments on commit baba031

Please sign in to comment.