Skip to content

Commit 6114120

Browse files
Merge forwardport of #13034 to 2.3-develop branch
Applied pull request patch https://github.com/magento/magento2/pull/13034.patch (created by @bhargavmehta) based on commit(s): 1. 149d08f 2. e851948 Fixed GitHub Issues in 2.3-develop branch: - #12221: Google analytics pageview being triggered twice (reported by @alexhadley)
2 parents 53e721c + 5fd7481 commit 6114120

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

app/code/Magento/GoogleAnalytics/view/frontend/web/js/google-analytics.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@ define([
5151
if (config.pageTrackingData.isAnonymizedIpActive) {
5252
ga('set', 'anonymizeIp', true);
5353
}
54-
ga('send', 'pageview' + config.pageTrackingData.optPageUrl);
5554

5655
// Process orders data
57-
if (config.ordersTrackingData) {
56+
if (config.ordersTrackingData.length) {
5857
ga('require', 'ec', 'ec.js');
5958

6059
ga('set', 'currencyCode', config.ordersTrackingData.currency);
@@ -74,6 +73,9 @@ define([
7473
}
7574

7675
ga('send', 'pageview');
76+
} else {
77+
// Process Data if not orders
78+
ga('send', 'pageview' + config.pageTrackingData.optPageUrl);
7779
}
7880
}
7981
}

0 commit comments

Comments
 (0)