Skip to content

Commit

Permalink
Merge branch 'nightly_11_oct' into prebid8_14_UOE_9665
Browse files Browse the repository at this point in the history
  • Loading branch information
pm-azhar-mulla authored and pm-azhar-mulla committed Oct 10, 2023
2 parents dd8edfa + 0476ccd commit 4c21869
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
5 changes: 2 additions & 3 deletions modules/pubmaticAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ function gatherPartnerBidsForAdUnitForLogger(adUnit, adUnitId, highestBid) {
'dc': bid.bidResponse ? (bid.bidResponse.dealChannel || EMPTY_STRING) : EMPTY_STRING,
'l1': bid.bidResponse ? bid.partnerTimeToRespond : 0,
'ol1': bid.bidResponse ? bid.clientLatencyTimeMs : 0,
'l2': bid?.serverPartnerLatency || 0,
'l2': 0,
'adv': bid.bidResponse ? getAdDomain(bid.bidResponse) || undefined : undefined,
'ss': isS2SBidder(bid.bidder),
't': (bid.status == ERROR && bid.error.code == TIMEOUT_ERROR) ? 1 : 0,
Expand Down Expand Up @@ -486,6 +486,7 @@ function executeBidsLoggerCall(e, highestCpmBids) {
outputObj['tis'] = frequencyDepth?.impressionServed;
outputObj['lip'] = frequencyDepth?.lip;
outputObj['tgid'] = getTgId();
outputObj['pbv'] = getGlobal()?.version || '-1';

if (floorData && floorFetchStatus) {
outputObj['fmv'] = floorData.floorRequestData ? floorData.floorRequestData.modelVersion || undefined : undefined;
Expand Down Expand Up @@ -530,7 +531,6 @@ function executeBidsLoggerCall(e, highestCpmBids) {
return slotsArray;
}, []);
outputObj.owv = window.PWT?.versionDetails?.openwrap_version || '-1';
outputObj.pbv = getGlobal()?.version || '-1';

auctionCache.sent = true;

Expand Down Expand Up @@ -669,7 +669,6 @@ function bidResponseHandler(args) {
const latency = args?.timeToRespond || Date.now() - cache.auctions[args.auctionId].timestamp;
const auctionTime = cache.auctions[args.auctionId].timeout;
// Check if latency is greater than auctiontime+150, then log auctiontime+150 to avoid large numbers
bid.serverPartnerLatency = args?.serverSideResponseTime;
bid.partnerTimeToRespond = latency > (auctionTime + 150) ? (auctionTime + 150) : latency;
bid.clientLatencyTimeMs = Date.now() - cache.auctions[args.auctionId].timestamp;
if (window.PWT && !!isFn(window.PWT.HookForBidReceived)) {
Expand Down
34 changes: 19 additions & 15 deletions test/spec/modules/pubmaticAnalyticsAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const BID = {
'requestTimestamp': 1519149628471,
'adUnitCode': '/19968336/header-bid-tag-0',
'timeToRespond': 944,
'serverSideResponseTime': 20,
'prebidBidId': '792d8d2135d28b',
'pbLg': '1.00',
'pbMg': '1.20',
Expand Down Expand Up @@ -420,6 +419,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.it).to.equal('hybrid');
expect(data.fmv).to.equal('floorModelTest');
expect(data.ft).to.equal(1);
expect(data.pbv).to.equal(getGlobal()?.version || '-1');
expect(data.s).to.be.an('array');
expect(data.s.length).to.equal(2);
expect(data.owv).to.equal(window?.PWT?.versionDetails?.openwrap_version || '-1');
Expand Down Expand Up @@ -454,7 +454,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[0].ps[0].dc).to.equal('');
expect(data.s[0].ps[0].l1).to.equal(944);
expect(data.s[0].ps[0].ol1).to.equal(3214);
expect(data.s[0].ps[0].l2).to.equal(20);
expect(data.s[0].ps[0].l2).to.equal(0);
expect(data.s[0].ps[0].ss).to.equal(1);
expect(data.s[0].ps[0].t).to.equal(0);
expect(data.s[0].ps[0].wb).to.equal(1);
Expand Down Expand Up @@ -492,7 +492,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[1].ps[0].adv).to.equal('example.com');
expect(data.s[0].ps[0].l1).to.equal(944);
expect(data.s[0].ps[0].ol1).to.equal(3214);
expect(data.s[1].ps[0].l2).to.equal(20);
expect(data.s[1].ps[0].l2).to.equal(0);
expect(data.s[1].ps[0].ss).to.equal(1);
expect(data.s[1].ps[0].t).to.equal(0);
expect(data.s[1].ps[0].wb).to.equal(1);
Expand Down Expand Up @@ -651,6 +651,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.pid).to.equal('1111');
expect(data.fmv).to.equal('floorModelTest');
expect(data.ft).to.equal(1);
expect(data.pbv).to.equal(getGlobal()?.version || '-1');
expect(data.s).to.be.an('array');
expect(data.s.length).to.equal(2);
expect(data.bm).not.to.be.null;
Expand Down Expand Up @@ -738,6 +739,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.it).to.equal('hybrid');
expect(data.fmv).to.equal('floorModelTest');
expect(data.ft).to.equal(1);
expect(data.pbv).to.equal(getGlobal()?.version || '-1');
expect(data.s).to.be.an('array');
expect(data.s.length).to.equal(2);
// slot 1
Expand Down Expand Up @@ -816,7 +818,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[1].ps[0].dc).to.equal('');
expect(data.s[1].ps[0].mi).to.equal(undefined);
expect(data.s[1].ps[0].l1).to.equal(0);
expect(data.s[1].ps[0].l2).to.equal(20);
expect(data.s[1].ps[0].l2).to.equal(0);
expect(data.s[1].ps[0].ss).to.equal(1);
expect(data.s[1].ps[0].t).to.equal(0);
expect(data.s[1].ps[0].wb).to.equal(0);
Expand Down Expand Up @@ -862,7 +864,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[1].ps[0].dc).to.equal('');
expect(data.s[1].ps[0].mi).to.equal(undefined);
expect(data.s[1].ps[0].l1).to.equal(0);
expect(data.s[1].ps[0].l2).to.equal(20);
expect(data.s[1].ps[0].l2).to.equal(0);
expect(data.s[1].ps[0].ss).to.equal(1);
expect(data.s[1].ps[0].t).to.equal(1);
expect(data.s[1].ps[0].wb).to.equal(0);
Expand Down Expand Up @@ -916,7 +918,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[1].ps[0].adv).to.equal('example.com');
expect(data.s[0].ps[0].l1).to.equal(0);
expect(data.s[0].ps[0].ol1).to.equal(0);
expect(data.s[1].ps[0].l2).to.equal(20);
expect(data.s[1].ps[0].l2).to.equal(0);
expect(data.s[1].ps[0].ss).to.equal(1);
expect(data.s[1].ps[0].t).to.equal(1);
expect(data.s[1].ps[0].wb).to.equal(1); // todo
Expand Down Expand Up @@ -980,7 +982,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[1].ps[0].adv).to.equal('example.com');
expect(data.s[0].ps[0].l1).to.equal(944);
expect(data.s[0].ps[0].ol1).to.equal(3214);
expect(data.s[1].ps[0].l2).to.equal(20);
expect(data.s[1].ps[0].l2).to.equal(0);
expect(data.s[1].ps[0].ss).to.equal(1);
expect(data.s[1].ps[0].t).to.equal(0);
expect(data.s[1].ps[0].wb).to.equal(0); // bidPriceUSD is not getting set as currency module is not added, so unable to set wb to 1
Expand Down Expand Up @@ -1036,7 +1038,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[1].ps[0].adv).to.equal('example.com');
expect(data.s[0].ps[0].l1).to.equal(944);
expect(data.s[0].ps[0].ol1).to.equal(3214);
expect(data.s[1].ps[0].l2).to.equal(20);
expect(data.s[1].ps[0].l2).to.equal(0);
expect(data.s[1].ps[0].ss).to.equal(1);
expect(data.s[1].ps[0].t).to.equal(0);
expect(data.s[1].ps[0].wb).to.equal(0); // bidPriceUSD is not getting set as currency module is not added, so unable to set wb to 1
Expand Down Expand Up @@ -1104,7 +1106,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[1].ps[0].adv).to.equal('example.com');
expect(data.s[0].ps[0].l1).to.equal(944);
expect(data.s[0].ps[0].ol1).to.equal(3214);
expect(data.s[1].ps[0].l2).to.equal(20);
expect(data.s[1].ps[0].l2).to.equal(0);
expect(data.s[1].ps[0].ss).to.equal(1);
expect(data.s[1].ps[0].t).to.equal(0);
expect(data.s[1].ps[0].wb).to.equal(0); // bidPriceUSD is not getting set as currency module is not added, so unable to set wb to 1
Expand Down Expand Up @@ -1164,7 +1166,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[1].ps[0].adv).to.equal('example.com');
expect(data.s[0].ps[0].l1).to.equal(944);
expect(data.s[0].ps[0].ol1).to.equal(3214);
expect(data.s[1].ps[0].l2).to.equal(20);
expect(data.s[1].ps[0].l2).to.equal(0);
expect(data.s[1].ps[0].ss).to.equal(1);
expect(data.s[1].ps[0].t).to.equal(0);
expect(data.s[1].ps[0].wb).to.equal(0); // bidPriceUSD is not getting set as currency module is not added, so unable to set wb to 1
Expand Down Expand Up @@ -1220,7 +1222,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[1].ps[0].adv).to.equal('example.com');
expect(data.s[0].ps[0].l1).to.equal(944);
expect(data.s[0].ps[0].ol1).to.equal(3214);
expect(data.s[1].ps[0].l2).to.equal(20);
expect(data.s[1].ps[0].l2).to.equal(0);
expect(data.s[1].ps[0].ss).to.equal(1);
expect(data.s[1].ps[0].t).to.equal(0);
expect(data.s[1].ps[0].wb).to.equal(0); // bidPriceUSD is not getting set as currency module is not added, so unable to set wb to 1
Expand Down Expand Up @@ -1329,6 +1331,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.tgid).to.equal(15);
expect(data.it).to.equal('hybrid');
expect(data.fmv).to.equal('floorModelTest');
expect(data.pbv).to.equal(getGlobal()?.version || '-1');
expect(data.ft).to.equal(1);
expect(data.s).to.be.an('array');
expect(data.s.length).to.equal(2);
Expand Down Expand Up @@ -1362,7 +1365,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[0].ps[0].dc).to.equal('');
expect(data.s[0].ps[0].l1).to.equal(944);
expect(data.s[0].ps[0].ol1).to.equal(3214);
expect(data.s[0].ps[0].l2).to.equal(20);
expect(data.s[0].ps[0].l2).to.equal(0);
expect(data.s[0].ps[0].ss).to.equal(0);
expect(data.s[0].ps[0].t).to.equal(0);
expect(data.s[0].ps[0].wb).to.equal(1);
Expand Down Expand Up @@ -1401,7 +1404,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[1].ps[0].adv).to.equal('example.com');
expect(data.s[0].ps[0].l1).to.equal(944);
expect(data.s[0].ps[0].ol1).to.equal(3214);
expect(data.s[1].ps[0].l2).to.equal(20);
expect(data.s[1].ps[0].l2).to.equal(0);
expect(data.s[1].ps[0].ss).to.equal(1);
expect(data.s[1].ps[0].t).to.equal(0);
expect(data.s[1].ps[0].wb).to.equal(1);
Expand Down Expand Up @@ -1469,6 +1472,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.tgid).to.equal(15);
expect(data.it).to.equal('hybrid');
expect(data.fmv).to.equal('floorModelTest');
expect(data.pbv).to.equal(getGlobal()?.version || '-1');
expect(data.ft).to.equal(1);
expect(data.s).to.be.an('array');
expect(data.s.length).to.equal(2);
Expand Down Expand Up @@ -1503,7 +1507,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[0].ps[0].dc).to.equal('');
expect(data.s[0].ps[0].l1).to.equal(944);
expect(data.s[0].ps[0].ol1).to.equal(3214);
expect(data.s[0].ps[0].l2).to.equal(20);
expect(data.s[0].ps[0].l2).to.equal(0);
expect(data.s[0].ps[0].ss).to.equal(0);
expect(data.s[0].ps[0].t).to.equal(0);
expect(data.s[0].ps[0].wb).to.equal(1);
Expand Down Expand Up @@ -1533,7 +1537,7 @@ describe('pubmatic analytics adapter', function () {
expect(data.s[1].ps[0].adv).to.equal('example.com');
expect(data.s[0].ps[0].l1).to.equal(944);
expect(data.s[0].ps[0].ol1).to.equal(3214);
expect(data.s[1].ps[0].l2).to.equal(20);
expect(data.s[1].ps[0].l2).to.equal(0);
expect(data.s[1].ps[0].ss).to.equal(1);
expect(data.s[1].ps[0].t).to.equal(0);
expect(data.s[1].ps[0].wb).to.equal(1);
Expand Down

0 comments on commit 4c21869

Please sign in to comment.