From 69de981681bf27c983fefaf5154ddee1e0c536cc Mon Sep 17 00:00:00 2001 From: Rachel Joyce Date: Tue, 1 Mar 2022 12:32:29 -0700 Subject: [PATCH] Get floor from correct places on bid object & replace div ID with size (#8093) Co-authored-by: Rachel Joyce --- modules/googleAnalyticsAdapter.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/googleAnalyticsAdapter.js b/modules/googleAnalyticsAdapter.js index 98c73f455b1..b4c4c8c7009 100644 --- a/modules/googleAnalyticsAdapter.js +++ b/modules/googleAnalyticsAdapter.js @@ -208,8 +208,13 @@ function sendBidRequestToGa(bid) { _analyticsQueue.push(function () { _eventCount++; if (_sendFloors) { - var floor = (bid.floorMin) ? bid.floorMin : 'No Floor'; - window[_gaGlobal](_trackerSend, 'event', _category, 'Requests by Floor=' + floor, 'Ad Unit=' + bid.adUnitCode + ',' + bid.bidderCode, 1, _disableInteraction); + var floor = 'No Floor'; + if (bid.floorData) { + floor = bid.floorData.floorValue; + } else if (bid.bids.length) { + floor = bid.bids[0].getFloor().floor; + } + window[_gaGlobal](_trackerSend, 'event', _category, 'Requests by Floor=' + floor, bid.bidderCode, 1, _disableInteraction); } else { window[_gaGlobal](_trackerSend, 'event', _category, 'Requests', bid.bidderCode, 1, _disableInteraction); } @@ -239,8 +244,8 @@ function sendBidResponseToGa(bid) { window[_gaGlobal](_trackerSend, 'event', 'Prebid.js CPM Distribution', cpmDis, bidder, 1, _disableInteraction); } if (_sendFloors) { - var floor = (bid.floorMin) ? bid.floorMin : 'No Floor'; - window[_gaGlobal](_trackerSend, 'event', _category, 'Bids by Floor=' + floor, 'Ad Unit=' + bid.adUnitCode + ',' + bidder, cpmCents, _disableInteraction); + var floor = (bid.floorData) ? bid.floorData.floorValue : 'No Floor'; + window[_gaGlobal](_trackerSend, 'event', _category, 'Bids by Floor=' + floor, 'Size=' + bid.size + ',' + bidder, cpmCents, _disableInteraction); } else { window[_gaGlobal](_trackerSend, 'event', _category, 'Bids', bidder, cpmCents, _disableInteraction); } @@ -270,8 +275,8 @@ function sendBidWonToGa(bid) { _analyticsQueue.push(function () { _eventCount++; if (_sendFloors) { - var floor = (bid.floorMin) ? bid.floorMin : 'No Floor'; - window[_gaGlobal](_trackerSend, 'event', _category, 'Wins by Floor=' + floor, 'Ad Unit=' + bid.adUnitCode + ',' + bid.bidderCode, cpmCents, _disableInteraction); + var floor = (bid.floorData) ? bid.floorData.floorValue : 'No Floor'; + window[_gaGlobal](_trackerSend, 'event', _category, 'Wins by Floor=' + floor, 'Size=' + bid.size + ',' + bid.bidderCode, cpmCents, _disableInteraction); } else { window[_gaGlobal](_trackerSend, 'event', _category, 'Wins', bid.bidderCode, cpmCents, _disableInteraction); }