Skip to content

Commit

Permalink
Merge pull request #6 from kapil-tuptewar/UOE-9819
Browse files Browse the repository at this point in the history
Uoe 9819
  • Loading branch information
kapil-tuptewar authored Nov 21, 2023
2 parents c354f86 + 958043a commit 1788b5f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/pubmaticAnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {_each, isArray, isStr, logError, logWarn, pick} from '../src/utils.js';
import {_each, isArray, isStr, logError, logWarn, pick, generateUUID} from '../src/utils.js';
import adapter from '../libraries/analyticsAdapter/AnalyticsAdapter.js';
import adapterManager from '../src/adapterManager.js';
import CONSTANTS from '../src/constants.json';
Expand Down Expand Up @@ -379,6 +379,7 @@ function executeBidsLoggerCall(e, highestCpmBids) {
'sz': getSizesForAdUnit(adUnit, adUnitId),
'ps': gatherPartnerBidsForAdUnitForLogger(adUnit, adUnitId, highestCpmBids.filter(bid => bid.adUnitCode === adUnitId)),
'fskp': floorData && floorFetchStatus ? (floorData.floorRequestData ? (floorData.floorRequestData.skipped == false ? 0 : 1) : undefined) : undefined,
'sid': generateUUID()
};
if (floorData?.floorRequestData) {
const { location, fetchStatus, floorProvider } = floorData?.floorRequestData;
Expand Down
18 changes: 18 additions & 0 deletions test/spec/modules/pubmaticAnalyticsAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ describe('pubmatic analytics adapter', function () {
// slot 1
expect(data.s[0].sn).to.equal('/19968336/header-bid-tag-0');
expect(data.s[0].fskp).to.equal(0);
expect(data.s[0].sid).not.to.be.undefined;
expect(data.s[0].ffs).to.equal(1);
expect(data.s[0].fsrc).to.equal(2);
expect(data.s[0].fp).to.equal('pubmatic');
Expand Down Expand Up @@ -406,6 +407,7 @@ describe('pubmatic analytics adapter', function () {
// slot 2
expect(data.s[1].sn).to.equal('/19968336/header-bid-tag-1');
expect(data.s[1].fskp).to.equal(0);
expect(data.s[1].sid).not.to.be.undefined;
expect(data.s[1].ffs).to.equal(1);
expect(data.s[1].fsrc).to.equal(2);
expect(data.s[1].fp).to.equal('pubmatic');
Expand Down Expand Up @@ -589,6 +591,7 @@ describe('pubmatic analytics adapter', function () {
// slot 1
expect(data.s[0].sn).to.equal('/19968336/header-bid-tag-0');
expect(data.s[0].fskp).to.equal(0);
expect(data.s[0].sid).not.to.be.undefined;
expect(data.s[0].ffs).to.equal(1);
expect(data.s[0].fsrc).to.equal(2);
expect(data.s[0].fp).to.equal('pubmatic');
Expand Down Expand Up @@ -711,9 +714,13 @@ describe('pubmatic analytics adapter', function () {
expect(data.tgid).to.equal(0);// test group id should be an INT between 0-15 else set to 0
expect(data.s[1].sn).to.equal('/19968336/header-bid-tag-1');
expect(data.s[1].fskp).to.equal(0);

expect(data.s[1].sid).not.to.be.undefined;

expect(data.s[1].ffs).to.equal(1);
expect(data.s[1].fsrc).to.equal(2);
expect(data.s[1].fp).to.equal('pubmatic');

expect(data.s[1].sz).to.deep.equal(['1000x300', '970x250', '728x90']);
expect(data.s[1].ps).to.be.an('array');
expect(data.s[1].ps.length).to.equal(1);
Expand Down Expand Up @@ -796,6 +803,7 @@ describe('pubmatic analytics adapter', function () {
let data = getLoggerJsonFromRequest(request.requestBody);
expect(data.s[1].sn).to.equal('/19968336/header-bid-tag-1');
expect(data.s[1].fskp).to.equal(0);
expect(data.s[1].sid).not.to.be.undefined;
expect(data.s[1].ffs).to.equal(1);
expect(data.s[1].fsrc).to.equal(2);
expect(data.s[1].fp).to.equal('pubmatic');
Expand Down Expand Up @@ -861,6 +869,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[1].sn).to.equal('/19968336/header-bid-tag-1');
expect(data.s[1].sz).to.deep.equal(['1000x300', '970x250', '728x90']);
expect(data.s[1].ps).to.be.an('array');
expect(data.s[1].sid).not.to.be.undefined;
expect(data.s[1].ps.length).to.equal(1);
expect(data.s[1].ps[0].pn).to.equal('pubmatic');
expect(data.s[1].ps[0].bc).to.equal('pubmatic');
Expand Down Expand Up @@ -908,6 +917,7 @@ describe('pubmatic analytics adapter', function () {
let data = getLoggerJsonFromRequest(request.requestBody);
expect(data.s[1].sn).to.equal('/19968336/header-bid-tag-1');
expect(data.s[1].fskp).to.equal(0);
expect(data.s[1].sid).not.to.be.undefined;
expect(data.s[1].ffs).to.equal(1);
expect(data.s[1].fsrc).to.equal(2);
expect(data.s[1].fp).to.equal('pubmatic');
Expand Down Expand Up @@ -970,6 +980,7 @@ describe('pubmatic analytics adapter', function () {
let data = getLoggerJsonFromRequest(request.requestBody);
expect(data.s[1].sn).to.equal('/19968336/header-bid-tag-1');
expect(data.s[1].sz).to.deep.equal(['1000x300', '970x250', '728x90']);
expect(data.s[1].sid).not.to.be.undefined;
expect(data.s[1].ps).to.be.an('array');
expect(data.s[1].ps.length).to.equal(1);
expect(data.s[1].ps[0].pn).to.equal('pubmatic');
Expand Down Expand Up @@ -1024,6 +1035,7 @@ describe('pubmatic analytics adapter', function () {
let data = getLoggerJsonFromRequest(request.requestBody);
expect(data.s[1].sn).to.equal('/19968336/header-bid-tag-1');
expect(data.s[1].fskp).to.equal(0);
expect(data.s[1].sid).not.to.be.undefined;
expect(data.s[1].ffs).to.equal(1);
expect(data.s[1].fsrc).to.equal(2);
expect(data.s[1].fp).to.equal('pubmatic');
Expand Down Expand Up @@ -1084,6 +1096,7 @@ describe('pubmatic analytics adapter', function () {
let data = getLoggerJsonFromRequest(request.requestBody);
expect(data.s[1].sn).to.equal('/19968336/header-bid-tag-1');
expect(data.s[1].sz).to.deep.equal(['1000x300', '970x250', '728x90']);
expect(data.s[1].sid).not.to.be.undefined;
expect(data.s[1].ps).to.be.an('array');
expect(data.s[1].ps.length).to.equal(1);
expect(data.s[1].ps[0].pn).to.equal('pubmatic');
Expand Down Expand Up @@ -1146,6 +1159,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[1].fsrc).to.equal(2);
expect(data.s[1].fp).to.equal('pubmatic');
expect(data.s[1].sz).to.deep.equal(['1000x300', '970x250', '728x90']);
expect(data.s[1].sid).not.to.be.undefined;
expect(data.s[1].ps).to.be.an('array');
expect(data.s[1].ps.length).to.equal(1);
expect(data.s[1].ps[0].pn).to.equal('pubmatic');
Expand Down Expand Up @@ -1224,6 +1238,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[0].fsrc).to.equal(2);
expect(data.s[0].fp).to.equal('pubmatic');
expect(data.s[0].sz).to.deep.equal(['640x480']);
expect(data.s[0].sid).not.to.be.undefined;
expect(data.s[0].ps).to.be.an('array');
expect(data.s[0].au).to.equal('/19968336/header-bid-tag-0');
expect(data.s[0].ps.length).to.equal(1);
Expand Down Expand Up @@ -1257,6 +1272,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[1].fsrc).to.equal(2);
expect(data.s[1].fp).to.equal('pubmatic');
expect(data.s[1].sz).to.deep.equal(['1000x300', '970x250', '728x90']);
expect(data.s[1].sid).not.to.be.undefined;
expect(data.s[1].ps).to.be.an('array');
expect(data.s[1].ps.length).to.equal(1);
expect(data.s[1].ps[0].pn).to.equal('pubmatic');
Expand Down Expand Up @@ -1352,6 +1368,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[0].fsrc).to.equal(2);
expect(data.s[0].fp).to.equal('pubmatic');
expect(data.s[0].sz).to.deep.equal(['640x480']);
expect(data.s[0].sid).not.to.be.undefined;
expect(data.s[0].ps).to.be.an('array');
expect(data.s[0].au).to.equal('/19968336/header-bid-tag-0');
expect(data.s[0].ps.length).to.equal(1);
Expand Down Expand Up @@ -1381,6 +1398,7 @@ describe('pubmatic analytics adapter', function () {
// slot 2
expect(data.s[1].sn).to.equal('/19968336/header-bid-tag-1');
expect(data.s[1].sz).to.deep.equal(['1000x300', '970x250', '728x90']);
expect(data.s[1].sid).not.to.be.undefined;
expect(data.s[1].ps).to.be.an('array');
expect(data.s[1].ps.length).to.equal(1);
expect(data.s[1].ps[0].pn).to.equal('pubmatic');
Expand Down

0 comments on commit 1788b5f

Please sign in to comment.