Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interstitial support for banner Imps #797

Merged
merged 5 commits into from
Jan 30, 2019
270 changes: 270 additions & 0 deletions config/interstitial.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
package config

// This is a first pass at providing a priority list for building out interstitial sizes.
// It is quite possible that different strategies may develop, requiring a configurable
// list to satisfy the needs of different hosting companies. So we start with a hardcoded
// list in the config module, to make it more straightforward to move to an actual
// configurable solution once the need develops and the use cases can be defined.

type InterstitialSize struct {
Width uint64
Height uint64
}

type InterstitialSizes []InterstitialSize

// This list was sourced from delivery statistics from Appnexus. A list of sizes sorted by
// size (larger first) and frequency(more common sizes first) with what seemed to be a good
// weighting factor balancing the two factors.
var ResolvedInterstitialSizes = InterstitialSizes{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where was the size list sourced from? Might be worth adding a comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was sourced from delivery statistics from Appnexus. A list of sizes sorted by size (larger first) and frequency(more common sizes first) with what seemed to be a good weighting factor balancing the two factors.

InterstitialSize{300, 250},
InterstitialSize{728, 90},
InterstitialSize{160, 600},
InterstitialSize{320, 50},
InterstitialSize{300, 600},
InterstitialSize{970, 250},
InterstitialSize{2000, 1400},
InterstitialSize{1920, 1200},
InterstitialSize{1800, 1000},
InterstitialSize{1920, 1080},
InterstitialSize{1600, 1150},
InterstitialSize{1696, 900},
InterstitialSize{1600, 900},
InterstitialSize{1270, 800},
InterstitialSize{970, 1000},
InterstitialSize{1920, 480},
InterstitialSize{320, 320},
InterstitialSize{1600, 500},
InterstitialSize{768, 1024},
InterstitialSize{1024, 768},
InterstitialSize{828, 910},
InterstitialSize{728, 970},
InterstitialSize{120, 600},
InterstitialSize{640, 960},
InterstitialSize{980, 600},
InterstitialSize{620, 891},
InterstitialSize{930, 600},
InterstitialSize{980, 552},
InterstitialSize{1272, 328},
InterstitialSize{300, 50},
InterstitialSize{500, 1000},
InterstitialSize{900, 550},
InterstitialSize{980, 500},
InterstitialSize{970, 500},
InterstitialSize{800, 600},
InterstitialSize{336, 280},
InterstitialSize{1250, 360},
InterstitialSize{980, 400},
InterstitialSize{320, 250},
InterstitialSize{320, 480},
InterstitialSize{980, 240},
InterstitialSize{580, 400},
InterstitialSize{970, 415},
InterstitialSize{480, 820},
InterstitialSize{620, 620},
InterstitialSize{980, 300},
InterstitialSize{970, 90},
InterstitialSize{600, 600},
InterstitialSize{1800, 200},
InterstitialSize{970, 310},
InterstitialSize{720, 480},
InterstitialSize{1295, 250},
InterstitialSize{300, 1050},
InterstitialSize{1272, 250},
InterstitialSize{300, 300},
InterstitialSize{640, 480},
InterstitialSize{320, 100},
InterstitialSize{580, 500},
InterstitialSize{1000, 300},
InterstitialSize{1250, 240},
InterstitialSize{600, 500},
InterstitialSize{300, 1000},
InterstitialSize{728, 410},
InterstitialSize{800, 250},
InterstitialSize{970, 300},
InterstitialSize{950, 300},
InterstitialSize{994, 250},
InterstitialSize{940, 300},
InterstitialSize{640, 320},
InterstitialSize{468, 600},
InterstitialSize{970, 200},
InterstitialSize{930, 180},
InterstitialSize{250, 600},
InterstitialSize{491, 555},
InterstitialSize{550, 480},
InterstitialSize{750, 300},
InterstitialSize{980, 250},
InterstitialSize{1000, 260},
InterstitialSize{980, 150},
InterstitialSize{350, 240},
InterstitialSize{970, 210},
InterstitialSize{640, 360},
InterstitialSize{580, 415},
InterstitialSize{480, 300},
InterstitialSize{750, 200},
InterstitialSize{360, 640},
InterstitialSize{624, 368},
InterstitialSize{900, 250},
InterstitialSize{468, 400},
InterstitialSize{608, 226},
InterstitialSize{690, 300},
InterstitialSize{605, 340},
InterstitialSize{320, 640},
InterstitialSize{450, 450},
InterstitialSize{300, 480},
InterstitialSize{250, 800},
InterstitialSize{640, 300},
InterstitialSize{320, 160},
InterstitialSize{980, 200},
InterstitialSize{950, 200},
InterstitialSize{480, 400},
InterstitialSize{740, 250},
InterstitialSize{336, 544},
InterstitialSize{303, 603},
InterstitialSize{320, 568},
InterstitialSize{301, 601},
InterstitialSize{300, 601},
InterstitialSize{600, 300},
InterstitialSize{180, 500},
InterstitialSize{980, 120},
InterstitialSize{950, 180},
InterstitialSize{935, 180},
InterstitialSize{994, 170},
InterstitialSize{468, 360},
InterstitialSize{320, 400},
InterstitialSize{320, 240},
InterstitialSize{320, 500},
InterstitialSize{316, 513},
InterstitialSize{630, 250},
InterstitialSize{480, 320},
InterstitialSize{320, 481},
InterstitialSize{520, 290},
InterstitialSize{250, 250},
InterstitialSize{300, 500},
InterstitialSize{1000, 150},
InterstitialSize{320, 460},
InterstitialSize{970, 150},
InterstitialSize{800, 180},
InterstitialSize{468, 60},
InterstitialSize{482, 282},
InterstitialSize{680, 200},
InterstitialSize{320, 416},
InterstitialSize{480, 280},
InterstitialSize{300, 431},
InterstitialSize{728, 180},
InterstitialSize{300, 430},
InterstitialSize{180, 701},
InterstitialSize{840, 150},
InterstitialSize{600, 200},
InterstitialSize{768, 150},
InterstitialSize{200, 600},
InterstitialSize{350, 350},
InterstitialSize{202, 600},
InterstitialSize{400, 300},
InterstitialSize{414, 286},
InterstitialSize{656, 180},
InterstitialSize{994, 118},
InterstitialSize{638, 180},
InterstitialSize{650, 170},
InterstitialSize{1000, 90},
InterstitialSize{300, 360},
InterstitialSize{600, 180},
InterstitialSize{240, 400},
InterstitialSize{161, 601},
InterstitialSize{610, 138},
InterstitialSize{164, 601},
InterstitialSize{980, 100},
InterstitialSize{970, 100},
InterstitialSize{468, 200},
InterstitialSize{250, 360},
InterstitialSize{320, 180},
InterstitialSize{605, 150},
InterstitialSize{600, 150},
InterstitialSize{980, 90},
InterstitialSize{750, 100},
InterstitialSize{150, 600},
InterstitialSize{630, 140},
InterstitialSize{696, 120},
InterstitialSize{307, 254},
InterstitialSize{303, 253},
InterstitialSize{703, 110},
InterstitialSize{550, 140},
InterstitialSize{300, 251},
InterstitialSize{298, 250},
InterstitialSize{500, 150},
InterstitialSize{413, 180},
InterstitialSize{728, 100},
InterstitialSize{269, 269},
InterstitialSize{640, 106},
InterstitialSize{768, 90},
InterstitialSize{320, 200},
InterstitialSize{728, 93},
InterstitialSize{729, 90},
InterstitialSize{727, 90},
InterstitialSize{640, 100},
InterstitialSize{720, 90},
InterstitialSize{300, 100},
InterstitialSize{970, 66},
InterstitialSize{480, 110},
InterstitialSize{300, 200},
InterstitialSize{707, 83},
InterstitialSize{900, 65},
InterstitialSize{467, 120},
InterstitialSize{200, 200},
InterstitialSize{450, 121},
InterstitialSize{320, 150},
InterstitialSize{600, 90},
InterstitialSize{300, 170},
InterstitialSize{468, 100},
InterstitialSize{300, 169},
InterstitialSize{500, 100},
InterstitialSize{300, 150},
InterstitialSize{990, 50},
InterstitialSize{140, 350},
InterstitialSize{160, 300},
InterstitialSize{300, 158},
InterstitialSize{190, 240},
InterstitialSize{180, 150},
InterstitialSize{300, 145},
InterstitialSize{310, 122},
InterstitialSize{468, 90},
InterstitialSize{594, 70},
InterstitialSize{480, 80},
InterstitialSize{600, 65},
InterstitialSize{484, 80},
InterstitialSize{320, 75},
InterstitialSize{335, 100},
InterstitialSize{375, 80},
InterstitialSize{300, 75},
InterstitialSize{120, 240},
InterstitialSize{480, 60},
InterstitialSize{300, 90},
InterstitialSize{120, 60},
InterstitialSize{100, 200},
InterstitialSize{320, 80},
InterstitialSize{160, 160},
InterstitialSize{400, 63},
InterstitialSize{300, 81},
InterstitialSize{1, 1},
InterstitialSize{300, 80},
InterstitialSize{375, 58},
InterstitialSize{232, 90},
InterstitialSize{321, 51},
InterstitialSize{320, 63},
InterstitialSize{319, 49},
InterstitialSize{300, 65},
InterstitialSize{360, 50},
InterstitialSize{125, 125},
InterstitialSize{298, 60},
InterstitialSize{300, 60},
InterstitialSize{299, 60},
InterstitialSize{301, 50},
InterstitialSize{234, 60},
InterstitialSize{280, 47},
InterstitialSize{120, 90},
InterstitialSize{13, 13},
InterstitialSize{17, 17},
InterstitialSize{168, 50},
InterstitialSize{140, 50},
InterstitialSize{120, 20},
}
38 changes: 38 additions & 0 deletions docs/endpoints/openrtb2/auction.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,51 @@ This adds two optional properties:

These fields will be forwarded to each Bidder, so they can decide how to process them.

#### Interstitial support
Additional support for interstitials is enabled through the addition of two fields to the request:
device.ext.prebid.interstitial.minwidthperc and device.ext.interstial.minheightperc
The values will be numbers that indicate the minimum allowed size for the ad, as a percentage of the base side. For example, a width of 600 and "minwidthperc": 60 would allow ads with widths from 360 to 600 pixels inclusive.

Example:
```
{
"imp": [
{
...
"banner": {
...
}
"instl": 1,
...
}
]
"device": {
...
"h": 640,
"w": 320,
"ext": {
"prebid": {
"interstitial": {
"minwidthperc": 60,
"minheightperc": 60
}
}
}
}
}
```

PBS receiving a request for an interstitial imp and these parameters set, it will rewrite the format object within the interstitial imp. If the format array's first object is a size, PBS will take it as the max size for the interstitial. If that size is 1x1, it will look up the device's size and use that as the max size. If the format is not present, it will also use the device size as the max size. (1x1 support so that you don't have to omit the format object to use the device size)
PBS with interstitial support will come preconfigured with a list of common ad sizes. Preferentially organized by weighing the larger and more common sizes first. But no guarantees to the ordering will be made. PBS will generate a new format list for the interstitial imp by traversing this list and picking the first 10 sizes that fall within the imp's max size and minimum percentage size. There will be no attempt to favor aspect ratios closer to the original size's aspect ratio. The limit of 10 is enforced to ensure we don't overload bidders with an overlong list. All the interstitial parameters will still be passed to the bidders, so they may recognize them and use their own size matching algorithms if they prefer.

### OpenRTB Ambiguities

This section describes the ways in which Prebid Server **implements** OpenRTB spec ambiguous parts.

- `request.cur`: If `request.cur` is not specified in the bid request, Prebid Server will consider it as being `USD` whereas OpenRTB spec doesn't mention any default currency for bid request.
```request.cur: ['USD'] // Default value if not set```


### OpenRTB Differences

This section describes the ways in which Prebid Server **breaks** the OpenRTB spec.
Expand Down
7 changes: 6 additions & 1 deletion endpoints/openrtb2/auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"time"

"github.com/buger/jsonparser"
"github.com/evanphx/json-patch"
jsonpatch "github.com/evanphx/json-patch"
"github.com/golang/glog"
"github.com/julienschmidt/httprouter"
"github.com/mssola/user_agent"
Expand Down Expand Up @@ -208,6 +208,11 @@ func (deps *endpointDeps) parseRequest(httpRequest *http.Request) (req *openrtb.
// Populate any "missing" OpenRTB fields with info from other sources, (e.g. HTTP request headers).
deps.setFieldsImplicitly(httpRequest, req)

if err := processInterstitials(req); err != nil {
errs = []error{err}
return
}

errL := deps.validateRequest(req)
if len(errL) > 0 {
errs = append(errs, errL...)
Expand Down
Loading