diff --git a/modules/pubmaticAnalyticsAdapter.js b/modules/pubmaticAnalyticsAdapter.js index dd59fde4e75..c7eeaf87fdc 100755 --- a/modules/pubmaticAnalyticsAdapter.js +++ b/modules/pubmaticAnalyticsAdapter.js @@ -286,8 +286,7 @@ function executeBidsLoggerCall(e, highestCpmBids) { function executeBidWonLoggerCall(auctionId, adUnitId) { const winningBidId = cache.auctions[auctionId].adUnitCodes[adUnitId].bidWon; - const requestId = cache.auctions[auctionId].adUnitCodes[adUnitId].requestId; - const winningBid = cache.auctions[auctionId].adUnitCodes[adUnitId].bids[requestId]; + const winningBid = cache.auctions[auctionId].adUnitCodes[adUnitId].bids[winningBidId]; let pixelURL = END_POINT_WIN_BID_LOGGER; pixelURL += 'pubid=' + publisherId; pixelURL += '&purl=' + enc(config.getConfig('pageUrl') || cache.auctions[auctionId].referer || ''); @@ -373,10 +372,8 @@ function bidderDoneHandler(args) { } function bidWonHandler(args) { - let adUnitCache = cache.auctions[args.auctionId].adUnitCodes[args.adUnitCode]; - adUnitCache.bidWon = args.adId; - adUnitCache.requestId = args.requestId; - adUnitCache.bids[args.requestId].bidId = args.adId; + let auctionCache = cache.auctions[args.auctionId]; + auctionCache.adUnitCodes[args.adUnitCode].bidWon = args.requestId; executeBidWonLoggerCall(args.auctionId, args.adUnitCode); } diff --git a/test/spec/modules/pubmaticAnalyticsAdapter_spec.js b/test/spec/modules/pubmaticAnalyticsAdapter_spec.js index ccc109a1050..b595ed1fa6e 100755 --- a/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +++ b/test/spec/modules/pubmaticAnalyticsAdapter_spec.js @@ -38,7 +38,7 @@ const BID = { 'statusMessage': 'Bid available', 'bidId': '2ecff0db240757', 'partnerImpId': 'partnerImpressionID-1', - 'adId': '2ecff0db240757', + 'adId': 'fake_ad_id', 'source': 's2s', 'requestId': '2ecff0db240757', 'currency': 'USD', @@ -77,7 +77,7 @@ const BID2 = Object.assign({}, BID, { adUnitCode: '/19968336/header-bid-tag-1', bidId: '3bd4ebb1c900e2', partnerImpId: 'partnerImpressionID-2', - adId: '3bd4ebb1c900e2', + adId: 'fake_ad_id_2', requestId: '3bd4ebb1c900e2', width: 728, height: 90,