-
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
Optimera Adapter for 1.0 (#1759) #1760
Conversation
} | ||
]; | ||
it('buildRequests fires', () => { | ||
var request = spec.buildRequests(validBidRequests); |
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.
You appear to be missing some assertions
modules/optimeraBidAdapter.js
Outdated
* @return boolean True if this is a valid bid, and false otherwise. | ||
*/ | ||
isBidRequestValid: function (bidRequest) { | ||
return !!(bidRequest.params.custom.clientID); |
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 will throw an exception custom.clientID
is not present. Should do safe evaluation, isBidRequestValid
should not throw.
modules/optimeraBidAdapter.js
Outdated
var timestamp = Math.round(new Date().getTime() / 1000); | ||
var clientID = validBidRequests[0].params.custom.clientID; | ||
var oDv = []; | ||
if (clientID != undefined) { |
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.
preferred method for undefined
check in javascript is if (typeof clientID !== 'undefined') {
modules/optimeraBidAdapter.js
Outdated
if (clientID != undefined) { | ||
oDv.push(clientID); | ||
for (var i = 0; i < validBidRequests.length; i++) { | ||
oDv.push(validBidRequests[i].placementCode); |
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.
bid.placementCode
has been deprecated, should be replaced with bid.adUnitCode
modules/optimeraBidAdapter.js
Outdated
oDv.push(validBidRequests[i].placementCode); | ||
} | ||
window.oDv = oDv; | ||
var scoresURL = SCORES_BASE_URL + clientID + '/' + optimeraHost + optimeraPathName + '.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.
This looks like JSONP.
1.0 adapters should use AJAX capable endpoints.
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.
For this call, the platform generates a static js file with the JSON set to a var, so there isn't a callback. We are able to parse it from serverRsponse.body
in interpretResponse
. We were hoping as long as this works ok it would be fine for now until the platform can be updated.
Hi @snapwich, the latest changes have been pushed. |
modules/optimeraBidAdapter.js
Outdated
for (var i = 0; i < validBidRequests.length; i++) { | ||
oDv.push(validBidRequests[i].adUnitCode); | ||
} | ||
window.oDv = oDv; |
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.
If your adapter is dependent on this global, then your adapter will not work with concurrent auctions (which is a requirement of 1.0).
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.
No problem. This is out and we can do it elsewhere.
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.
LGTM, probably needs another review though
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 change requested. Also, when testing this locally and on your test page, getting a 403 (Forbidden)
response from the SCORES_BASE_URL
-- is this still the right endpoint for your adapter?
modules/optimeraBidAdapter.js
Outdated
dealId = scores[validBids[i].adUnitCode]; | ||
} | ||
var bidResponse = { | ||
bidderCode: spec.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.
bidderCode
will be set automatically by bidderFactory
now, this line can be dropped
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 ok, I removed the bidderCode. Yes, that endpoint is correct, we just had an error and that has been restored. The Travis build failed, but passes on my local. Can you rerun the build? Thank you.
interpretResponse: function (serverResponse, bidRequest) { | ||
var scores = serverResponse.body.replace('window.oVa = ', ''); | ||
scores = scores.replace(';', ''); | ||
scores = JSON.parse(scores); |
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.
Any JSON.parse
calls will need to be in a try/catch block
} | ||
var bidResponse = { | ||
requestId: validBids[i].bidId, | ||
ad: '<div></div>', |
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 might have been mentioned before, but how do you render the ad if there is no ad content?
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 @mkendall07, we are just creating this adpator to add visibility scores for the ad divs that will be added to DFP calls.
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 but what does a publisher do with that information? And why is a request to your endpoint required to calculate viewability?
@mkendall07 Hi there. We are building this adapter specifically for a use case that a client wanted. Our technology is a targeting tech that normally pushes data directly into DFP in the header. We are utilizing prebid as a way to push data points into DFP so the client does not need to change their hardcode in order to work with us. The client will already know what to do with this data in their ad platform because of our preexisting relationship. |
@kcandiotti Due to the reliance on an external script, we aren't going to accept this adapter into the 1.0 version of prebid. We will be publishing some guidelines about how you can include open source external resource dependencies in just a bit. Once that is out, you can resubmit the adapter. Thanks for your patience. |
Type of change
Type of issue
Feature Request
Description
Adding Optimera's bid adapter for public use. Optimera's technology allows publishers to target viewability data to automate viewability optimization for any line item or PMP. Optimera does not push bids but instead targeting data via the deal ID space.
test parameters for validating bids
hb_deal_optimera=RB_K,300x250K,300x600K&hb_size_optimera=0x0&hb_pb_optimera=0.00&hb_adid_optimera=86a7b6905fe174&hb_bidder_optimera=optimera
An external lib is needed and can be added to the site's footer:
contact email of the adapter’s maintainer
[email protected]
Other information
Test Page:
http://optimera.elasticbeanstalk.com/prebidDemoPage.php
@kcandiotti
Relates to PR: #1617