Skip to content

Commit

Permalink
always adding originalCpm and originalCurrency to bid object (#3856)
Browse files Browse the repository at this point in the history
  • Loading branch information
pm-harshad-mane authored and jsnellbaker committed Jun 3, 2019
1 parent 7aa0e0d commit ac65812
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/currency.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ export function addBidResponseHook(fn, adUnitCode, bid) {
return (parseFloat(this.cpm) * getCurrencyConversion(this.currency, toCurrency)).toFixed(3);
};

bid.originalCpm = bid.cpm;
bid.originalCurrency = bid.currency;

// execute immediately if the bid is already in the desired currency
if (bid.currency === adServerCurrency) {
return fn.call(this, adUnitCode, bid);
Expand All @@ -209,8 +212,6 @@ function wrapFunction(fn, context, params) {
let fromCurrency = bid.currency;
try {
let conversion = getCurrencyConversion(fromCurrency);
bid.originalCpm = bid.cpm;
bid.originalCurrency = bid.currency;
if (conversion !== 1) {
bid.cpm = (parseFloat(bid.cpm) * conversion).toFixed(4);
bid.currency = adServerCurrency;
Expand Down

0 comments on commit ac65812

Please sign in to comment.