Skip to content
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

Merged

Conversation

paprikka
Copy link
Contributor

Type of change

  • Bugfix

Description of change

Ensure that the Unruly Bid Adapter can be used on sites where the Unruly Universal Tag has not been configured separately. This is a backwards-compatible change and it doesn't require any actions on Publisher's side.

@@ -6,7 +6,7 @@ import { VIDEO } from '../src/mediaTypes'
function configureUniversalTag (exchangeRenderer) {
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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please add a check to verify exchangeRenderer.config is defined before trying to access siteId?

I notice this exchangeRenderer object comes from your serverBid, and you may guarantee that this is always defined, but we would prefer to be defensive here please !

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to void Error: Cannot read property 'siteId' of undefined

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Roger that—throwing meaningful exceptions unless siteId is available.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paprikka Thanks,

quick question, where exactly does this exchangeRenderer.config come from?

The Unruly server request?

Is it set by the publisher somewhere?

Copy link
Contributor Author

@paprikka paprikka Jun 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exchangeRenderer.config comes from the bidResponse (passed as an ext).

Copy link
Collaborator

Choose a reason for hiding this comment

The 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!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done. Thanks!

@ghost ghost force-pushed the feat/bid-response-site-id branch from a4bb5a6 to d97238f Compare June 7, 2019 11:46
@paprikka
Copy link
Contributor Author

paprikka commented Jun 7, 2019

Regarding the CI issue: I've re-run the tests and everything seems fine on our side, can't access the CircleCI logs though—can you trigger another run?

Copy link
Collaborator

@robertrmartinez robertrmartinez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this! 👍

@@ -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.')
Copy link
Collaborator

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.

Copy link
Contributor Author

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?

Copy link
Collaborator

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!

Copy link
Collaborator

@robertrmartinez robertrmartinez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@robertrmartinez robertrmartinez merged commit 5715a02 into prebid:master Jun 12, 2019
VideoReach pushed a commit to VideoReach/Prebid.js that referenced this pull request Aug 1, 2019
… renderer (prebid#3865)

* feat(unruly-bid-adapter): use bidResponse siteId when configuring the renderer

* feat(unruly-bid-adapter): bail if siteId is missing

* feat(unruly-bid-adapter): log (but don't throw) when siteId is no present
sa1omon pushed a commit to gamoshi/Prebid.js that referenced this pull request Nov 28, 2019
… renderer (prebid#3865)

* feat(unruly-bid-adapter): use bidResponse siteId when configuring the renderer

* feat(unruly-bid-adapter): bail if siteId is missing

* feat(unruly-bid-adapter): log (but don't throw) when siteId is no present
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants