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

PBjs Core Price Floors Module: improve logging on bid rejections to clarify which CPM is being compared with which floor #8655

Merged
merged 2 commits into from
Jul 11, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion modules/priceFloors.js
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,14 @@ export function addBidResponseHook(fn, adUnitCode, bid) {
flooredBid.status = CONSTANTS.BID_STATUS.BID_REJECTED;
// if floor not met update bid with 0 cpm so it is not included downstream and marked as no-bid
flooredBid.cpm = 0;
logWarn(`${MODULE_NAME}: ${flooredBid.bidderCode}'s Bid Response for ${adUnitCode} was rejected due to floor not met`, bid);
const floorMsg = (() => {
try {
return ` (adjusted cpm: ${bid.floorData.cpmAfterAdjustments.toFixed(2)}, floor: ${floorInfo.matchingFloor.toFixed(2)})`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have a feeling the lack of precision is going to generate more bug reports when the rounded values are equal; how about toFixed(4)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

how about keeping the full precision then? (because if 2 digits are not enough why would 4 be?)

} catch (e) {
return ''
}
})();
logWarn(`${MODULE_NAME}: ${flooredBid.bidderCode}'s Bid Response for ${adUnitCode} was rejected due to floor not met${floorMsg}`, bid);
return fn.call(this, adUnitCode, flooredBid);
}
return fn.call(this, adUnitCode, bid);
Expand Down