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

Price Floors: Add modelWeight as reportable dimension #6126

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions modules/priceFloors.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ export function updateAdUnitsForAuction(adUnits, floorData, auctionId) {
skipRate: floorData.skipRate,
floorMin: floorData.floorMin,
modelVersion: utils.deepAccess(floorData, 'data.modelVersion'),
modelWeight: utils.deepAccess(floorData, 'data.modelWeight'),
modelTimestamp: utils.deepAccess(floorData, 'data.modelTimestamp'),
location: utils.deepAccess(floorData, 'data.location', 'noData'),
floorProvider: floorData.floorProvider,
Expand Down
1 change: 1 addition & 0 deletions modules/rubiconAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ function sendMessage(auctionId, bidWonId) {
auction.floors = utils.pick(auctionCache.floorData, [
'location',
'modelVersion as modelName',
'modelWeight',
'modelTimestamp',
'skipped',
'enforcement', () => utils.deepAccess(auctionCache.floorData, 'enforcements.enforceJS'),
Expand Down
25 changes: 25 additions & 0 deletions test/spec/modules/priceFloors_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe('the price floors module', function () {
let clock;
const basicFloorData = {
modelVersion: 'basic model',
modelWeight: 10,
modelTimestamp: 1606772895,
currency: 'USD',
schema: {
Expand All @@ -38,6 +39,7 @@ describe('the price floors module', function () {
const basicFloorDataHigh = {
floorMin: 7.0,
modelVersion: 'basic model',
modelWeight: 10,
currency: 'USD',
schema: {
delimiter: '|',
Expand All @@ -52,6 +54,7 @@ describe('the price floors module', function () {
const basicFloorDataLow = {
floorMin: 2.3,
modelVersion: 'basic model',
modelWeight: 10,
currency: 'USD',
schema: {
delimiter: '|',
Expand Down Expand Up @@ -185,6 +188,7 @@ describe('the price floors module', function () {
let resultingData = getFloorsDataForAuction(inputFloorData, 'test_div_1');
expect(resultingData).to.deep.equal({
modelVersion: 'basic model',
modelWeight: 10,
modelTimestamp: 1606772895,
currency: 'USD',
schema: {
Expand All @@ -203,6 +207,7 @@ describe('the price floors module', function () {
resultingData = getFloorsDataForAuction(inputFloorData, 'this_is_a_div');
expect(resultingData).to.deep.equal({
modelVersion: 'basic model',
modelWeight: 10,
modelTimestamp: 1606772895,
currency: 'USD',
schema: {
Expand Down Expand Up @@ -432,6 +437,7 @@ describe('the price floors module', function () {
skipped: true,
floorMin: undefined,
modelVersion: undefined,
modelWeight: undefined,
modelTimestamp: undefined,
location: 'noData',
skipRate: 0,
Expand Down Expand Up @@ -467,6 +473,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'adUnit Model Version',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'adUnit',
skipRate: 0,
Expand Down Expand Up @@ -501,6 +508,7 @@ describe('the price floors module', function () {
validateBidRequests(true, {
skipped: false,
modelVersion: 'adUnit Model Version',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'adUnit',
skipRate: 0,
Expand All @@ -516,6 +524,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'basic model',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'setConfig',
skipRate: 0,
Expand All @@ -538,6 +547,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'basic model',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'setConfig',
skipRate: 0,
Expand All @@ -553,6 +563,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'basic model',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'setConfig',
skipRate: 0,
Expand All @@ -568,6 +579,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'basic model',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'setConfig',
skipRate: 0,
Expand All @@ -592,6 +604,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'basic model',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'setConfig',
skipRate: 50,
Expand All @@ -607,6 +620,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'basic model',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'setConfig',
skipRate: 10,
Expand All @@ -622,6 +636,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'basic model',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'setConfig',
skipRate: 0,
Expand Down Expand Up @@ -687,6 +702,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'model-1',
modelWeight: 10,
modelTimestamp: undefined,
location: 'setConfig',
skipRate: 0,
Expand All @@ -701,6 +717,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'model-2',
modelWeight: 40,
modelTimestamp: undefined,
location: 'setConfig',
skipRate: 0,
Expand All @@ -715,6 +732,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'model-3',
modelWeight: 50,
modelTimestamp: undefined,
location: 'setConfig',
skipRate: 0,
Expand Down Expand Up @@ -745,6 +763,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'basic model',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'setConfig',
skipRate: 0,
Expand Down Expand Up @@ -825,6 +844,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'basic model',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'setConfig',
skipRate: 0,
Expand Down Expand Up @@ -864,6 +884,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'fetch model name',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'fetch',
skipRate: 0,
Expand Down Expand Up @@ -902,6 +923,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'fetch model name',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'fetch',
skipRate: 0,
Expand Down Expand Up @@ -943,6 +965,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'fetch model name',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'fetch',
skipRate: 95,
Expand All @@ -966,6 +989,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'basic model',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'setConfig',
skipRate: 0,
Expand All @@ -991,6 +1015,7 @@ describe('the price floors module', function () {
skipped: false,
floorMin: undefined,
modelVersion: 'basic model',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'setConfig',
skipRate: 0,
Expand Down
3 changes: 3 additions & 0 deletions test/spec/modules/rubiconAnalyticsAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,7 @@ describe('rubicon analytics adapter', function () {
auctionInit.bidderRequests[0].bids[0].floorData = {
skipped: false,
modelVersion: 'someModelName',
modelWeight: 10,
modelTimestamp: 1606772895,
location: 'setConfig',
skipRate: 15,
Expand Down Expand Up @@ -954,6 +955,7 @@ describe('rubicon analytics adapter', function () {
expect(message.auctions[0].floors).to.deep.equal({
location: 'setConfig',
modelName: 'someModelName',
modelWeight: 10,
modelTimestamp: 1606772895,
skipped: false,
enforcement: true,
Expand Down Expand Up @@ -1000,6 +1002,7 @@ describe('rubicon analytics adapter', function () {
expect(message.auctions[0].floors).to.deep.equal({
location: 'setConfig',
modelName: 'someModelName',
modelWeight: 10,
modelTimestamp: 1606772895,
skipped: false,
enforcement: true,
Expand Down