From e851948a93f63887f053559802b6de1348db4a56 Mon Sep 17 00:00:00 2001
From: Bhargav Mehta <bhargavmehta44@gmail.com>
Date: Mon, 8 Jan 2018 17:26:35 +0530
Subject: [PATCH] Updated code to make it more efficient.

---
 .../GoogleAnalytics/view/frontend/web/js/google-analytics.js  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/code/Magento/GoogleAnalytics/view/frontend/web/js/google-analytics.js b/app/code/Magento/GoogleAnalytics/view/frontend/web/js/google-analytics.js
index 4f6f3e9ae88..cd6292b39e9 100644
--- a/app/code/Magento/GoogleAnalytics/view/frontend/web/js/google-analytics.js
+++ b/app/code/Magento/GoogleAnalytics/view/frontend/web/js/google-analytics.js
@@ -51,7 +51,6 @@ define([
             if (config.pageTrackingData.isAnonymizedIpActive) {
                 ga('set', 'anonymizeIp', true);
             }
-            ga('send', 'pageview' + config.pageTrackingData.optPageUrl);
 
             // Process orders data
             if (config.ordersTrackingData.length) {
@@ -75,6 +74,9 @@ define([
                 }
 
                 ga('send', 'pageview');
+            }else{
+                // Process Data if not orders
+                ga('send', 'pageview' + config.pageTrackingData.optPageUrl);
             }
         }
     }
-- 
GitLab