-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add support for OpenRTB protocol and endpoint #2102
Conversation
d207b48
to
a405382
Compare
3700692
to
5a02b24
Compare
What's the status on this -- is it ready for review @matthewlane ? |
@bretg Yes, status is ready for review |
Cool. Added the Needs Docs label as well. Ought to have page on prebid.org somewhere describing the different endpoints. Will the legacy endpoint be phased out at some point? |
I'll work on a docs draft. Not sure on legacy endpoint being phased out or timing, ccing @mkendall07 @dbemiller for comment |
Legacy endpoint will definitely be phased out... but no specific timeline yet. I'd planned to get rid of it once the metrics said that the traffic was low enough (and Rubicon agreed, and we left the PR deleting them open for a week or so in case anyone else wanted to complain). I haven't been using prebid.org at all, because I find jekyll to be annoying and I think there's a lot of value in keeping the docs in the same repo as the code... but there's documentation for some of the endpoints here. The folder structure & filenames of We should definitely update these two pages, though:
Once prebid.js uses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looking pretty good. I have some questions and nitpicks that I left.
modules/prebidServerBidAdapter.js
Outdated
*/ | ||
const protocolAdapter = () => { | ||
const OPEN_RTB_PATH = 'openrtb2/auction'; | ||
const isOpenRtb = _s2sConfig.endpoint.includes(OPEN_RTB_PATH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is polyfilled. Either way, it's probably safer using a regex or something to validate that this is at the end of the endpoint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the legacy test pages I found originally had an endpoint configured like https://prebid.adnxs.com/pbs/v1/auction?url_override=...
, so checking for the end of the string might not work. Good point about the polyfill, updated to use old school indexOf
rather than the string version of includes
modules/prebidServerBidAdapter.js
Outdated
if (digiTrust) { | ||
requestJson.digiTrust = digiTrust; | ||
request.digiTrust = digiTrust; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens to this app
, device
, digiTrust
, etc stuff if we use the OpenRTB endpoint? Can we pass it as ext
data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, will find out
Edit: yes, these are supported by the OpenRTB endpoint, pushed an update to send them
modules/prebidServerBidAdapter.js
Outdated
if (bannerParams && bannerParams.sizes) { | ||
// get banner sizes in form [{ w: <int>, h: <int> }, ...] | ||
const format = bannerParams.sizes.reduce((acc, size) => | ||
[...acc, { w: size[0], h: size[1] }], []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a perfect candidate for Array#map, is there a reason for using reduce? Also, I think creating a new array on each iteration of the reduce is less than ideal for performance.
modules/prebidServerBidAdapter.js
Outdated
|
||
// get bidder params in form { <bidder code>: {...params} } | ||
const ext = adUnit.bids.reduce((acc, bid) => | ||
Object.assign({}, acc, { [bid.bidder]: bid.params }), {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same performance complaint as a above.
const ext = adUnit.bids.reduce((acc, bid) => {
acc[bid.bidder] = bid.params;
return acc;
}, {})
In my opinion this is more readable, but opinion aside it's definitely going to perform much better as it's not doing additional iteration per each loop (each arg passed to Object.assign
is extra iteration) and not instantiating a bunch of throwaway object literals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, totally blanked on the way of doing this, thanks, updated
a8b090e
to
065da41
Compare
065da41
to
e20ba0d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthewlane
When I test this using our hello world page and the new ORTB endpoint, I receive the following error from PBS:
Invalid request format: request.imp[%d] must contain at least one of "banner", "video", "audio", or "native"
Request payload that generated the error:
{
"id": "44cb5fb9-33d8-4767-978e-d2be5819225c",
"site": {
"publisher": {
"id": "c9d412ee-3cc6-4b66-9326-9f49d528f13e"
}
},
"source": {
"tid": "44cb5fb9-33d8-4767-978e-d2be5819225c"
},
"tmax": 1000,
"imp": [{
"id": "div-gpt-ad-1460505748561-0",
"ext": {
"appnexus": {
"placementId": 10433394
}
},
"secure": 0
}],
"test": 0
}
@mkendall07 Thanks, updated to default to |
const OPEN_RTB_PATH = 'openrtb2/auction'; | ||
|
||
const endpoint = (_s2sConfig && _s2sConfig.endpoint) || ''; | ||
const isOpenRtb = ~endpoint.indexOf(OPEN_RTB_PATH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice operator usage :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, nice work
Type of change
Description of change
Adds support to prebidServer adapter for working with the OpenRTB prebid-server endpoint. Enable support by configuring s2s to use an endpoint with the pattern
openrtb2/auction
:When
s2sConfig.endpoint
is not configured to this type of endpoint, prebidServer communicates with the configured endpoint using the existing s2s protocol.Other information
Fixes #2126