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

Do not load external js if renderer defined on adUnit #3284

Merged
merged 2 commits into from
Nov 20, 2018

Conversation

jaiminpanchal27
Copy link
Collaborator

@jaiminpanchal27 jaiminpanchal27 commented Nov 9, 2018

Do not merge

Type of change

  • Bugfix

Description of change

Fixes #2805, Delaying loading of external js for winning bid will be done in a separate PR. This one just fixes a bug.

If renderer is defined on adUnit level, Renderer module will not load external js returned by bid. As of now 12 adapters are using Renderer. We need to update those if this approach is fine.

Copy link
Collaborator

@jsnellbaker jsnellbaker left a comment

Choose a reason for hiding this comment

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

See comment/question in-line below.

Also, is there a unit test where we're loading the Renderer as if we had it coming from the adUnit? It doesn't seem like we're testing this scenario.

// we expect to load a renderer url once only so cache the request to load script
loadScript(url, this.callback, true);
} else {
utils.logWarn(`External Js not loaded by Renderer since renderer url and callback is already defined on adUnit ${adUnitCode}`);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this need to be a warning?

Given the nature of the setup (ie defining a renderer in the adunit), this seems like a logInfo type message since the user isn't doing anything wrong and the code is handling this scenario as expected. Unless I'm missing something?

Copy link
Collaborator Author

@jaiminpanchal27 jaiminpanchal27 Nov 20, 2018

Choose a reason for hiding this comment

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

Here the user has set that renderer defined on adUnit will render the bid but the demand partners they are working with are using different js to render.

@@ -246,6 +248,7 @@ function newBid(serverBid, rtbBid, bidderRequest) {
currency: 'USD',
netRevenue: true,
ttl: 300,
adUnitCode: bidRequest.adUnitCode,
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed on the bid?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Code in master was pointing to bid.adUnitCode which was undefined until now. Hence i added it.

renderer: newRenderer(bid.adUnitCode, rtbBid, rendererOptions)

Copy link
Member

@mkendall07 mkendall07 left a comment

Choose a reason for hiding this comment

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

LGTM, one question.

@jaiminpanchal27 jaiminpanchal27 merged commit 706f569 into master Nov 20, 2018
pedrolopezmrf pushed a commit to Marfeel/Prebid.js that referenced this pull request Mar 18, 2019
* do not load external js if renderer defined on adUnit

* Added unit test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants