Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit 69de981

Browse files
Rachel JoyceRachel Joyce
Rachel Joyce
and
Rachel Joyce
authored
Get floor from correct places on bid object & replace div ID with size (prebid#8093)
Co-authored-by: Rachel Joyce <[email protected]>
1 parent 72022b7 commit 69de981

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

modules/googleAnalyticsAdapter.js

+11-6
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,13 @@ function sendBidRequestToGa(bid) {
208208
_analyticsQueue.push(function () {
209209
_eventCount++;
210210
if (_sendFloors) {
211-
var floor = (bid.floorMin) ? bid.floorMin : 'No Floor';
212-
window[_gaGlobal](_trackerSend, 'event', _category, 'Requests by Floor=' + floor, 'Ad Unit=' + bid.adUnitCode + ',' + bid.bidderCode, 1, _disableInteraction);
211+
var floor = 'No Floor';
212+
if (bid.floorData) {
213+
floor = bid.floorData.floorValue;
214+
} else if (bid.bids.length) {
215+
floor = bid.bids[0].getFloor().floor;
216+
}
217+
window[_gaGlobal](_trackerSend, 'event', _category, 'Requests by Floor=' + floor, bid.bidderCode, 1, _disableInteraction);
213218
} else {
214219
window[_gaGlobal](_trackerSend, 'event', _category, 'Requests', bid.bidderCode, 1, _disableInteraction);
215220
}
@@ -239,8 +244,8 @@ function sendBidResponseToGa(bid) {
239244
window[_gaGlobal](_trackerSend, 'event', 'Prebid.js CPM Distribution', cpmDis, bidder, 1, _disableInteraction);
240245
}
241246
if (_sendFloors) {
242-
var floor = (bid.floorMin) ? bid.floorMin : 'No Floor';
243-
window[_gaGlobal](_trackerSend, 'event', _category, 'Bids by Floor=' + floor, 'Ad Unit=' + bid.adUnitCode + ',' + bidder, cpmCents, _disableInteraction);
247+
var floor = (bid.floorData) ? bid.floorData.floorValue : 'No Floor';
248+
window[_gaGlobal](_trackerSend, 'event', _category, 'Bids by Floor=' + floor, 'Size=' + bid.size + ',' + bidder, cpmCents, _disableInteraction);
244249
} else {
245250
window[_gaGlobal](_trackerSend, 'event', _category, 'Bids', bidder, cpmCents, _disableInteraction);
246251
}
@@ -270,8 +275,8 @@ function sendBidWonToGa(bid) {
270275
_analyticsQueue.push(function () {
271276
_eventCount++;
272277
if (_sendFloors) {
273-
var floor = (bid.floorMin) ? bid.floorMin : 'No Floor';
274-
window[_gaGlobal](_trackerSend, 'event', _category, 'Wins by Floor=' + floor, 'Ad Unit=' + bid.adUnitCode + ',' + bid.bidderCode, cpmCents, _disableInteraction);
278+
var floor = (bid.floorData) ? bid.floorData.floorValue : 'No Floor';
279+
window[_gaGlobal](_trackerSend, 'event', _category, 'Wins by Floor=' + floor, 'Size=' + bid.size + ',' + bid.bidderCode, cpmCents, _disableInteraction);
275280
} else {
276281
window[_gaGlobal](_trackerSend, 'event', _category, 'Wins', bid.bidderCode, cpmCents, _disableInteraction);
277282
}

0 commit comments

Comments
 (0)