-
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 ADSpend bidder adapter #3005
Conversation
This pull request introduces 1 alert when merging 5da6ee3 into e1e03db - view on LGTM.com new alerts:
Comment posted by LGTM.com |
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.
Left feedback. This also requires tests, documentation, and probably should have GDPR handling as well.
modules/adspendBidAdapter.js
Outdated
|
||
export const spec = { | ||
code: BIDDER_CODE, | ||
aliases: ['adspend'], |
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 alias should be removed. The adapter is already known as the "adspend" adapter by filename convention.
modules/adspendBidAdapter.js
Outdated
const cpm = winObj.cpm; | ||
const event = getWinEvent(requestId).replace(/\$\{AUCTION_PRICE\}/, cpm); | ||
|
||
fetch(event); |
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.
Please use regular AJAX requests. fetch
is not supported in IE 11. There is an ajax helper function in the core Prebid code.
modules/adspendBidAdapter.js
Outdated
isBidRequestValid: function(bid) { | ||
const conf = config.getConfig(); | ||
return !!(conf.currency && | ||
conf.currency.adServerCurrency && |
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.
just do config.getConfig('currency.adServerCurrency')
. Nested access could potentially throw whereas getConfig
uses safe deep access.
}, | ||
|
||
buildRequests: function(bidRequests, bidderRequest) { | ||
const req = bidRequests[Math.floor(Math.random() * bidRequests.length)]; |
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.
Can you please explain why you are only responding to random bid requests?
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 made some changes. Do you still have questions?
modules/adspendBidAdapter.js
Outdated
const conf = config.getConfig(); | ||
return !!(conf.currency && | ||
conf.currency.adServerCurrency && | ||
bid.crumbs.pubcid && |
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.
The documentation should probably specify somewhere that the pubcid module is required
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.
Do you mean adspendBidAdapter.md
file?
modules/adspendBidAdapter.js
Outdated
const requestId = resp.body.id; | ||
|
||
document.cookie = | ||
`on_win_event__${requestId}=${respBid.nurl}; max-age=${COOKIE_EXPIRE}`; |
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 see you using this cookie in the getWinEvent
. Is there something that necessitates this being stored in a cookie rather than just in memory?
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. Looks like you're right, I should store it in memory
How can I add GDRP handling? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
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
* Add ADSpend bidder adapter * Remove superfluous argument and fix bug with sizes * Change bidder aliases * Replace fetch with ajax from src/ajax.js * Store win event URL in memory, not in cookie * Use getConfig(...) instead of nested access * Add sending multiple impressions to bidder
Type of change
Description of change
It's a test banner, so you'll see some errors in console cause it will be trying to call our system's events.
Be sure to test the integration with your adserver using the Hello World sample page.
For any changes that affect user-facing APIs or example code documented on http://prebid.org, please provide:
Other information