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

firing new adRenderFailed event when renderAd() fails #2210

Merged
merged 4 commits into from
Mar 20, 2018

Conversation

vedantseta
Copy link
Contributor

Type of change

  • Feature

Description of change

This pull request resolves #2133 . If renderAd() fails for some reason, an event adRenderFailed is fired with data object which includes the error message and bid object if available.

@vedantseta vedantseta changed the title firing AD_RENDER_FAILED event when renderAd() fails firing adRenderFailed event when renderAd() fails Mar 2, 2018
@vedantseta vedantseta changed the title firing adRenderFailed event when renderAd() fails firing new adRenderFailed event when renderAd() fails Mar 3, 2018
@vedantseta
Copy link
Contributor Author

added a reason key, so can GROUP BY easily.

@vedantseta vedantseta force-pushed the feature/ad-render-fail-event branch from a8d49d8 to ba7fcbe Compare March 4, 2018 12:50
@jaiminpanchal27
Copy link
Collaborator

@vedantseta Thanks for PR. Please add unit tests

@vedantseta
Copy link
Contributor Author

yes, sure. will add the same in few days.

@vedantseta
Copy link
Contributor Author

@jaiminpanchal27 , can you please check

Copy link
Collaborator

@jaiminpanchal27 jaiminpanchal27 left a comment

Choose a reason for hiding this comment

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

LGTM

@jaiminpanchal27
Copy link
Collaborator

@vedantseta Can you also submit a docs PR to the docs repo for this contribution.

You need to update https://github.com/prebid/prebid.github.io/blob/master/dev-docs/publisher-api-reference.md for new event to be added to the list on this page. http://prebid.org/dev-docs/publisher-api-reference.html#module_pbjs.onEvent

@vedantseta
Copy link
Contributor Author

@jaiminpanchal27 , have updated the docs of the same

@jaiminpanchal27
Copy link
Collaborator

@vedantseta Thanks for contributing. Since this is core change, someone from our team will do a 2nd review and merge.

src/prebid.js Outdated
@@ -229,7 +233,10 @@ $$PREBID_GLOBAL$$.renderAd = function (doc, id) {
if (renderer && renderer.url) {
renderer.render(bid);
} else if ((doc === document && !utils.inIframe()) || mediaType === 'video') {
utils.logError(`Error trying to write ad. Ad render call ad id ${id} was prevented from writing to the main document.`);
error.status = true;
error.bid = bid;
Copy link
Member

@mkendall07 mkendall07 Mar 13, 2018

Choose a reason for hiding this comment

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

all this repeat code can go into a function. Pass the status string.

@vedantseta
Copy link
Contributor Author

@mkendall07 , can you please check now?

@vedantseta
Copy link
Contributor Author

@jaiminpanchal27 @mkendall07 have refactored the code, can you please check?

src/prebid.js Outdated

data.reason = reason;
data.message = message;
if (data.bid) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wanted to check if this logic is properly configured. It seems like this if condition would never be met because the data is initialized as empty each time the function is called, so the data.bid property would always be undefined. Can you please take a look and clarify?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed. Changing that

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.

LGTM

@jsnellbaker jsnellbaker merged commit a577521 into prebid:master Mar 20, 2018
mifefr added a commit to mifefr/Prebid.js that referenced this pull request Mar 29, 2018
* 'master' of https://github.com/prebid/Prebid.js:
  EngageBDR New Bid Adapter (prebid#2309)
  [FEAT] adunit sizes support (prebid#2320)
  Support aliases in prebidServer (prebid#2257)
  Changing default currency file to https (prebid#2306)
  Update stalebot labels (prebid#2319)
  Enhance location detection within utils (prebid#2167)
  if cache markup is not enabled, set it to the default value 0 (prebid#2302)
  Serverbid Bid Adapter: Added archon alias (prebid#2293)
  Smart Ad Server: Fix bug when multi bids (prebid#2170)
  NEW adapter AdtelligentBidAdapter (prebid#2137)
  add optional param to bridgewellBidAdapter (prebid#2289)
  Increment Pre Version
  Prebid 1.6.0 Release
  Unit test fixes (prebid#2301)
  PBS videoCacheKey and vastUrl (prebid#2101)
  Add Oneplanetonly Bid Adapter (prebid#2269)
  firing new adRenderFailed event when renderAd() fails (prebid#2210)
  Add Content Ignite adapter (prebid#2268)
  add hb_cache_id, hb_uuid should be deprecated and replaced by hb_cache_id (prebid#2273)
  Update Yieldlab adapter and add official maintainer (prebid#2231)
  Update for Media.net adapter (prebid#2232)
  Update to Rubicon Adapter for mediaTypes support (prebid#2272)
  message formatting (prebid#2285)
  Yieldbot impression image creation fix (prebid#2277)
  Updated Bid params (prebid#2275)
  Audience Network: Add 'pbv' and 'cb' query params (prebid#2252)
  Add e-planning analytics adapter (prebid#2211)
  Add vastUrl for Gamma Adapter Video (prebid#2261)
  update params for test bid (prebid#2267)
  Updated adUnitCode (prebid#2262)
dluxemburg pushed a commit to Genius/Prebid.js that referenced this pull request Jul 17, 2018
* firing adRenderFailed when ad render fails

* test case added

* refactored adRenderFail event

* Condition changed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bidWonFailure event - Fire off event in the case that there is an error rendering from pbjs.renderAd
4 participants