Skip to content

Commit

Permalink
Rubicon Analytics: Do not overwrite billing type (prebid#9017)
Browse files Browse the repository at this point in the history
* Do not overwrite `type`

* safe check it always comes and is non empty string
  • Loading branch information
robertrmartinez authored Sep 20, 2022
1 parent 1b4885a commit 7f8d671
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions modules/rubiconAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ function formatSource(src) {
}

function getBillingPayload(event) {
// for now we are mapping all events to type "general", later we will expand support for specific types
let billingEvent = deepClone(event);
billingEvent.type = 'general';
// Pass along type if is string and not empty else general
billingEvent.type = (typeof event.type === 'string' && event.type) || 'general';
billingEvent.accountId = accountId;
// mark as sent
deepSetValue(cache.billing, `${event.vendor}.${event.billingId}`, true);
Expand Down
14 changes: 7 additions & 7 deletions test/spec/modules/rubiconAnalyticsAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2366,7 +2366,7 @@ describe('rubicon analytics adapter', function () {
});
basicBillingAuction([{
vendor: 'vendorName',
type: 'auction',
type: 'pageView',
billingId: 'f8558d41-62de-4349-bc7b-2dbee1e69965'
}]);
expect(server.requests.length).to.equal(1);
Expand All @@ -2376,7 +2376,7 @@ describe('rubicon analytics adapter', function () {
expect(message.billableEvents).to.deep.equal([{
accountId: 1001,
vendor: 'vendorName',
type: 'general', // mapping all events to endpoint as 'general' for now
type: 'pageView',
billingId: 'f8558d41-62de-4349-bc7b-2dbee1e69965'
}]);
});
Expand All @@ -2398,7 +2398,7 @@ describe('rubicon analytics adapter', function () {
},
{
vendor: 'vendorName',
type: 'auction',
type: 'impression',
billingId: '743db6e3-21f2-44d4-917f-cb3488c6076f'
},
{
Expand All @@ -2415,13 +2415,13 @@ describe('rubicon analytics adapter', function () {
{
accountId: 1001,
vendor: 'vendorName',
type: 'general',
type: 'auction',
billingId: 'f8558d41-62de-4349-bc7b-2dbee1e69965'
},
{
accountId: 1001,
vendor: 'vendorName',
type: 'general',
type: 'impression',
billingId: '743db6e3-21f2-44d4-917f-cb3488c6076f'
}
]);
Expand Down Expand Up @@ -2450,7 +2450,7 @@ describe('rubicon analytics adapter', function () {
{
accountId: 1001,
vendor: 'vendorName',
type: 'general',
type: 'auction',
billingId: 'f8558d41-62de-4349-bc7b-2dbee1e69965'
}
]);
Expand Down Expand Up @@ -2480,7 +2480,7 @@ describe('rubicon analytics adapter', function () {
{
accountId: 1001,
vendor: 'vendorName',
type: 'general',
type: 'auction',
billingId: 'f8558d41-62de-4349-bc7b-2dbee1e69965'
}
]);
Expand Down

0 comments on commit 7f8d671

Please sign in to comment.