-
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
Option to use a configurable vendor preset for s2sConfig #2073
Conversation
modules/prebidServerBidAdapter.js
Outdated
syncEndpoint: '//prebid.adnxs.com/pbs/v1/cookie_sync', | ||
timeout: 1000 | ||
}, | ||
'rubicon': {} |
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.
Rubicon's PBS defaults:
adapter: 'prebidServer',
cookieSet: true,
cookieSetUrl: 'https://secure-assets.rubiconproject.com/utils/cookieset/cs.js',
enabled: true,
endpoint: 'https://prebid-server.rubiconproject.com/auction',
syncEndpoint: 'https://prebid-server.rubiconproject.com/cookie_sync',
timeout: 500
{code}
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.
Hi @bretg, Thanks for submitting the information. Just to confirm, you do want to have hard-coded secure protocol for the URLs? For the AppNexus vendor, we were leaving them out to be dynamically populated based on the page. Thanks.
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.
Hey @bretg, I've submitted the Rubicon config as is for now (as I had some other changes I wanted to submit). If you want to have the values changed in lieu of the above (or any other reason), please feel free to let me know and I can make the updates.
Added docs PR (see bottom of original comment). |
@@ -475,5 +475,62 @@ describe('S2S Adapter', () => { | |||
config.setConfig({ s2sConfig: options }); | |||
sinon.assert.calledOnce(logErrorSpy); | |||
}); | |||
|
|||
it('should log error when vendor does not exist', () => { |
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.
Is there a test to show there's a failure when 'defaultVendor' doesn't exist but endpoint isn't specified? This will show there's no default-defaultVendor.
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.
Hey @bretg - I'm not sure I follow what you mean. Can you please clarify further when you get the chance?
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.
I think he's saying to add a test case to assert an error when both endpoint & vendor default are not specified in the S2S config (or vendor default doesn't exist)
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.
OK, thanks for that clarification. I've added a test case in the next commit.
…l cookieSet issue
modules/prebidServerBidAdapter.js
Outdated
cookieSet: true, | ||
cookieSetUrl: 'https://secure-assets.rubiconproject.com/utils/cookieset/cs.js', | ||
enabled: true, | ||
endpoint: 'https://prebid-server.rubiconproject.com/auction', |
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.
@bretg
You want these hardcoded to HTTPS right?
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.
We've been avoiding the protocol-relative URLs due to articles like
https://stackoverflow.com/questions/28446314/why-use-protocol-relative-urls-at-all
https://jeremywagner.me/blog/stop-using-the-protocol-relative-url/
You haven't seen issues with protocol-relative URLs?
In any case, go ahead with this for now and we'll start the conversation internally.
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.
Talked to @mkendall07 -- the issue here is that non-secure demand is left on the table for HTTPS.
So, yes, let's switch the endpoints to protocol-relative. Thanks Matt. We'll take this discussion up internally as well.
modules/prebidServerBidAdapter.js
Outdated
|
||
if (availVendorDefaults.hasOwnProperty(vendor)) { | ||
Object.keys(availVendorDefaults[vendor]).forEach(function(vendorKey) { | ||
if (s2sDefaultConfig[vendorKey] === options[vendorKey]) { |
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.
I read somewhere that you shouldn't write code as clever as you are, because debugging code is 2x more difficult than writing it. So if you write clever code, you by definition cannot debug it... :)
Ok it's probably an exaggeration but the point remains. It took me awhile to figure out why this works - it's because its compare undefined
to undefined
(in the case of a missing key) and so it's actually proceeding to copy to undefined key over. It's not necessarily wrong, it's just hard to read. At minimum it needs a comment, or ideally a nicer way to understand what's going on in code.
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.
Thanks for the feedback @mkendall07, I've just finished making a slight change to hopefully infer the logic better. I also put in a comment as a backup. Please let me know your thoughts.
modules/prebidServerBidAdapter.js
Outdated
'rubicon': { | ||
adapter: 'prebidServer', | ||
cookieSet: true, | ||
cookieSetUrl: 'https://secure-assets.rubiconproject.com/utils/cookieset/cs.js', |
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.
We discussed -- please remove the cookieSetUrl for Rubicon and turn cookieSet to false. Thanks. Also make "endpoint" protocol-relative. Thanks.
All requested changes should be in place at this time. Please take a look again and let me know. Thanks. |
* initial commit to support pbs vendor config options * correcting a value in a test case * adding rubicon config info and updated var names * made changes to unit tests, changed cookieSet default, and fixed small cookieSet issue * tweaking logic of main check to read it better * adjusting rubicon vendor values and default config to fix issue * undoing default config change * additional changes to rubicon defaults
Type of change
Description of change
I have added support for end-users to optionally use a configurable pbs vendor preset in their
setConfig({s2sConfig: {...})
page code. By using thisdefaultVendor
option, the end-user won't have to specify a majority of the data-points that are generally needed for this object.Below is an example usage:
Two of the required s2sConfig attributes will still be expected to be supplied by the end-user; these are
accountId
andbidders
(as depicted above). All of the other commonly used attributes are configured under a vendor object and are invoked by using thedefaultVendor
attribute.While all these vendor settings will be automatically populated based on established defaults, end-users will still have the ability to override any individual vendor settings by simply including the attribute in their page-code (same as they would today).
An example of this would look like:
Of also note - the vendor settings are configured overwrite the normally assigned system default values for the s2sConfig (assuming there is no user override). So ultimately s2sConfig settings are established in the following hierarchy:
User overrides > vendor settings > system defaults
For any changes that affect user-facing APIs or example code documented on http://prebid.org, please provide:
added information on new s2sConfig option prebid.github.io#579