Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Analytics Adapter: fix floor data in GA #8093

Merged
merged 1 commit into from
Mar 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions modules/googleAnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -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);
}