Skip to content

Commit 6c58188

Browse files
committed
MAGETWO-86630: Magento 2.2 Develop fix for #12221 Google Analytics Pageview Triggered twice #13034
- Merge Pull Request #13034 from bhargavmehta/magento2:2.2-dev-fix - Merged commits: 1. 149d08f 2. e851948
2 parents 5bd0104 + e851948 commit 6c58188

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
//Set currency code
@@ -75,6 +74,9 @@ define([
7574
}
7675

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

0 commit comments

Comments
 (0)