Skip to content

Commit

Permalink
Price Floors (prebid#4931)
Browse files Browse the repository at this point in the history
* Price Floors (prebid#52)

* Initial Commit
Code cleanup + PBS Changes + tests still needed

* Refactor to remove event

* forgot to remove FLOOR_NOT_MET

* Clean up code

* broke out req params

* floorNotMet is not bidRejected

* clean up module, more requirements on bid and analytics adapters

moved gpt matching into a util function

* test updates + currency conversion now on global

* asdf

* floor data object schema changed
updated to object not array

* Selection function now needs to sort by number of *'s in the rule
Rubicon get video floor use actual player size

* Updated json schema

* tests finished

* domain is more sophisticated now

* Currency floors refactored a little
Added log for when bid is floored

* update tests after additional data passed to analytics

* analytics reqs updated

* test update

* update to cache lookups
Analytics adapter update
tests updated for cache lookup

* reverting temp stuff

* Pulling latest from master = few probs
Small currency bug

* revert newline

* improved rule selection for getFloor

* new api for adding new fields overrides
if debug on, resp hook after debug hook
small bug in overwriting data object

* handle adjustment factor of 0

* removed size and mt specific logic and pushed to matching func

* adding comments for all funcs

* Added tests for rubicon adapters
handle matchign keys with dot's

* undefined data should be ignored

* remove unnecessary -1 plus semi colon

* md file

* removing temp test file

* prebid uses native image size as a single array

so we wrap it

* Forgot IE 11 no have includes!

* if enforcement not passed in default it
Exact match not found, then *

* no need to decode uri entire url when just wanting hostname

* setting auctionId on bidRequests so `onBeforeRequestBids` has context for getFloor()

* rubi analytics new values

* js rounding fix + isNaN handling

* random parenthesis

* fixing formula

Co-authored-by: rmartinez <Rachael24!>
  • Loading branch information
robertrmartinez authored and iggyfisk committed Jun 22, 2020
1 parent 94871dd commit 95e1bb6
Show file tree
Hide file tree
Showing 14 changed files with 2,082 additions and 18 deletions.
4 changes: 2 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ function test(done) {

execa(wdioCmd, wdioOpts, { stdio: 'inherit' })
.then(stdout => {
//kill mock server
// kill mock server
mockServer.kill('SIGINT');
done();
process.exit(0);
})
.catch(err => {
//kill mock server
// kill mock server
mockServer.kill('SIGINT');
done(new Error(`Tests failed with error: ${err}`));
process.exit(1);
Expand Down
4 changes: 4 additions & 0 deletions modules/currency.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getGlobal } from '../src/prebidGlobal.js';
import { createBid } from '../src/bidfactory.js';
import { STATUS } from '../src/constants.json';
import { ajax } from '../src/ajax.js';
Expand Down Expand Up @@ -122,6 +123,8 @@ function initCurrency(url) {

utils.logInfo('Installing addBidResponse decorator for currency module', arguments);

// Adding conversion function to prebid global for external module and on page use
getGlobal().convertCurrency = (cpm, fromCurrency, toCurrency) => parseFloat(cpm) * getCurrencyConversion(fromCurrency, toCurrency);
getHook('addBidResponse').before(addBidResponseHook, 100);

// call for the file if we haven't already
Expand Down Expand Up @@ -149,6 +152,7 @@ function resetCurrency() {
utils.logInfo('Uninstalling addBidResponse decorator for currency module', arguments);

getHook('addBidResponse').getHooks({hook: addBidResponseHook}).remove();
delete getGlobal().convertCurrency;

adServerCurrency = 'USD';
conversionCache = {};
Expand Down
Loading

0 comments on commit 95e1bb6

Please sign in to comment.