Skip to content

Commit

Permalink
bidmanager: emit bid response/adjustment events only after bid is ful…
Browse files Browse the repository at this point in the history
…ly built
  • Loading branch information
kitwestneat committed Jun 15, 2017
1 parent 58676ed commit 045e4ee
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/bidmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,6 @@ exports.addBidResponse = function (adUnitCode, bid) {

bid.timeToRespond = bid.responseTimestamp - bid.requestTimestamp;

// emit the bidAdjustment event before bidResponse, so bid response has the adjusted bid value
events.emit(CONSTANTS.EVENTS.BID_ADJUSTMENT, bid);

// emit the bidResponse event
events.emit(CONSTANTS.EVENTS.BID_RESPONSE, bid);

// append price strings
const priceStringsObj = getPriceBucketString(bid.cpm, _customPriceBucket);
bid.pbLg = priceStringsObj.low;
Expand All @@ -138,6 +132,12 @@ exports.addBidResponse = function (adUnitCode, bid) {
bid.adserverTargeting = keyValues;
$$PREBID_GLOBAL$$._bidsReceived.push(bid);

// emit the bidAdjustment event before bidResponse, so bid response has the adjusted bid value
events.emit(CONSTANTS.EVENTS.BID_ADJUSTMENT, bid);

// emit the bidResponse event
events.emit(CONSTANTS.EVENTS.BID_RESPONSE, bid);

if (bid.adUnitCode && bidsBackAdUnit(bid.adUnitCode)) {
triggerAdUnitCallbacks(bid.adUnitCode);
}
Expand Down

0 comments on commit 045e4ee

Please sign in to comment.