Skip to content

Commit

Permalink
Revert "Pubmatic Analytics Adapter : skip duplicate data for pubmatic…
Browse files Browse the repository at this point in the history
… bids in logger and tracker (#10787)"

This reverts commit 048f735.
  • Loading branch information
patmmccann authored Dec 12, 2023
1 parent 5dbbf1b commit 5bdbd9d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 259 deletions.
38 changes: 4 additions & 34 deletions modules/pubmaticAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {getGptSlotInfoForAdUnitCode} from '../libraries/gptUtils/gptUtils.js';

/// /////////// CONSTANTS //////////////
const ADAPTER_CODE = 'pubmatic';
const VENDOR_OPENWRAP = 'openwrap';
const SEND_TIMEOUT = 2000;
const END_POINT_HOST = 'https://t.pubmatic.com/';
const END_POINT_BID_LOGGER = END_POINT_HOST + 'wl?';
Expand Down Expand Up @@ -259,27 +258,12 @@ function isS2SBidder(bidder) {
return (s2sBidders.indexOf(bidder) > -1) ? 1 : 0
}

function isOWPubmaticBid(adapterName) {
let s2sConf = config.getConfig('s2sConfig');
let s2sConfArray = isArray(s2sConf) ? s2sConf : [s2sConf];
return s2sConfArray.some(conf => {
if (adapterName === ADAPTER_CODE && conf.defaultVendor === VENDOR_OPENWRAP &&
conf.bidders.indexOf(ADAPTER_CODE) > -1) {
return true;
}
})
}

function gatherPartnerBidsForAdUnitForLogger(adUnit, adUnitId, highestBid) {
highestBid = (highestBid && highestBid.length > 0) ? highestBid[0] : null;
return Object.keys(adUnit.bids).reduce(function(partnerBids, bidId) {
adUnit.bids[bidId].forEach(function(bid) {
let adapterName = getAdapterNameForAlias(bid.adapterCode || bid.bidder);
if (isOWPubmaticBid(adapterName) && isS2SBidder(bid.bidder)) {
return;
}
partnerBids.push({
'pn': adapterName,
'pn': getAdapterNameForAlias(bid.adapterCode || bid.bidder),
'bc': bid.bidderCode || bid.bidder,
'bidid': bid.bidId || bidId,
'db': bid.bidResponse ? 0 : 1,
Expand Down Expand Up @@ -434,20 +418,13 @@ function executeBidsLoggerCall(e, highestCpmBids) {
function executeBidWonLoggerCall(auctionId, adUnitId) {
const winningBidId = cache.auctions[auctionId].adUnitCodes[adUnitId].bidWon;
const winningBids = cache.auctions[auctionId].adUnitCodes[adUnitId].bids[winningBidId];
if (!winningBids) {
logWarn(LOG_PRE_FIX + 'Could not find winningBids for : ', auctionId);
return;
}

let winningBid = winningBids[0];

if (winningBids.length > 1) {
winningBid = winningBids.filter(bid => bid.adId === cache.auctions[auctionId].adUnitCodes[adUnitId].bidWonAdId)[0];
}

const adapterName = getAdapterNameForAlias(winningBid.adapterCode || winningBid.bidder);
if (isOWPubmaticBid(adapterName) && isS2SBidder(winningBid.bidder)) {
return;
}
let origAdUnit = getAdUnit(cache.auctions[auctionId].origAdUnits, adUnitId) || {};
let auctionCache = cache.auctions[auctionId];
let floorData = auctionCache.floorData;
Expand Down Expand Up @@ -500,10 +477,7 @@ function executeBidWonLoggerCall(auctionId, adUnitId) {
function auctionInitHandler(args) {
s2sBidders = (function() {
let s2sConf = config.getConfig('s2sConfig');
let s2sBidders = [];
(s2sConf || []) &&
isArray(s2sConf) ? s2sConf.map(conf => s2sBidders.push(...conf.bidders)) : s2sBidders.push(...s2sConf.bidders);
return s2sBidders || [];
return (s2sConf && isArray(s2sConf.bidders)) ? s2sConf.bidders : [];
}());
let cacheEntry = pick(args, [
'timestamp',
Expand Down Expand Up @@ -534,10 +508,6 @@ function bidRequestedHandler(args) {
}

function bidResponseHandler(args) {
if (!args.requestId) {
logWarn(LOG_PRE_FIX + 'Got null requestId in bidResponseHandler');
return;
}
let bid = cache.auctions[args.auctionId].adUnitCodes[args.adUnitCode].bids[args.requestId][0];
if (!bid) {
logError(LOG_PRE_FIX + 'Could not find associated bid request for bid response with requestId: ', args.requestId);
Expand Down Expand Up @@ -602,7 +572,7 @@ function auctionEndHandler(args) {
let highestCpmBids = getGlobal().getHighestCpmBids() || [];
setTimeout(() => {
executeBidsLoggerCall.call(this, args, highestCpmBids);
}, (cache.auctions[args.auctionId]?.bidderDonePendingCount === 0 ? 500 : SEND_TIMEOUT));
}, (cache.auctions[args.auctionId].bidderDonePendingCount === 0 ? 500 : SEND_TIMEOUT));
}

function bidTimeoutHandler(args) {
Expand Down
Loading

0 comments on commit 5bdbd9d

Please sign in to comment.