-
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
feat(unruly-bid-adapter): use bidResponse siteId when configuring the renderer #3865
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,12 @@ import { registerBidder } from '../src/adapters/bidderFactory' | |
import { VIDEO } from '../src/mediaTypes' | ||
|
||
function configureUniversalTag (exchangeRenderer) { | ||
if (!exchangeRenderer.config) throw new Error('UnrulyBidAdapter: Missing renderer config.') | ||
if (!exchangeRenderer.config.siteId) throw new Error('UnrulyBidAdapter: Missing renderer siteId.') | ||
|
||
parent.window.unruly = parent.window.unruly || {}; | ||
parent.window.unruly['native'] = parent.window.unruly['native'] || {}; | ||
parent.window.unruly['native'].siteId = parent.window.unruly['native'].siteId || exchangeRenderer.siteId; | ||
parent.window.unruly['native'].siteId = parent.window.unruly['native'].siteId || exchangeRenderer.config.siteId; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you please add a check to verify I notice this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Want to void There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Roger that—throwing meaningful exceptions unless There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @paprikka Thanks, quick question, where exactly does this The Unruly server request? Is it set by the publisher somewhere? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, okay. So the suggestion here is to not throw an error, but instead use the log utils to log the error and return the expected value back to prebid core. for example, Prebid Core expects the bids back as an array. So instead of throwing the error, Can we update to log the error, and simply return back an empty array to Prebid core? Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, done. Thanks! |
||
parent.window.unruly['native'].supplyMode = 'prebid'; | ||
} | ||
|
||
|
@@ -35,9 +38,18 @@ const serverResponseToBid = (bid, rendererInstance) => ({ | |
|
||
const buildPrebidResponseAndInstallRenderer = bids => | ||
bids | ||
.filter(serverBid => !!utils.deepAccess(serverBid, 'ext.renderer')) | ||
.filter(serverBid => { | ||
const hasConfig = !!utils.deepAccess(serverBid, 'ext.renderer.config'); | ||
const hasSiteId = !!utils.deepAccess(serverBid, 'ext.renderer.config.siteId'); | ||
|
||
if (!hasConfig) utils.logError(new Error('UnrulyBidAdapter: Missing renderer config.')); | ||
if (!hasSiteId) utils.logError(new Error('UnrulyBidAdapter: Missing renderer siteId.')); | ||
|
||
return hasSiteId | ||
}) | ||
.map(serverBid => { | ||
const exchangeRenderer = utils.deepAccess(serverBid, 'ext.renderer'); | ||
|
||
configureUniversalTag(exchangeRenderer); | ||
configureRendererQueue(); | ||
|
||
|
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.
@paprikka
Are these checks now irrelevant?
Due to the filter, it seems a bid would never come into this function unless it already has the config and siteID.
Obviously this is not a show-stopper, but if it is irrelevant, please remove it.
If you do not get to it before the release scheduled for tomorrow, I will make sure to still merge it and we can update in a later PR.
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, yes—these are not required any more.
I'm afraid I don't time to deal with this today—will submit another PR later this week if that's ok?
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.
Yes, please do not forget to update it when you have a chance!