]> _ Git - fluidbook-html5.git/commitdiff
wait #3861 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 31 Aug 2020 09:47:51 +0000 (11:47 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 31 Aug 2020 09:47:51 +0000 (11:47 +0200)
js/libs/fluidbook/fluidbook.stats.js

index 7eddfb6ebcc8f94de873ff1ba9316a24501bbef2..ab23795e66fd305513b5e547139a1592e6f58633 100644 (file)
@@ -11,9 +11,13 @@ function FluidbookStats(fluidbook) {
     if (this.fluidbook.settings.googleAnalytics !== '') {\r
         this.ga = 'gtag';\r
         this.gaCodes = this.fluidbook.settings.googleAnalytics.split(',');\r
-        gtag('js', new Date());\r
+        if (window.gtag !== undefined) {\r
+            gtag('js', new Date());\r
+        }\r
         $.each(this.gaCodes, function (k, code) {\r
-            gtag('config', code, {'send_page_view': false});\r
+            if (window.gtag !== undefined) {\r
+                gtag('config', code, {'send_page_view': false});\r
+            }\r
         });\r
     } else {\r
         if ('ga' in window) {\r
@@ -37,6 +41,8 @@ function FluidbookStats(fluidbook) {
 }\r
 \r
 FluidbookStats.prototype = {\r
+\r
+\r
     init: function () {\r
 \r
         var $this = this;\r
@@ -162,10 +168,14 @@ FluidbookStats.prototype = {
 \r
             if (c) {\r
                 $.each(this.gaCodes, function (k, code) {\r
-                    gtag(f, code, o);\r
+                    if (window.gtag !== undefined) {\r
+                        gtag(f, code, o);\r
+                    }\r
                 });\r
             } else {\r
-                gtag(f, a, o);\r
+                if (window.gtag !== undefined) {\r
+                    gtag(f, a, o);\r
+                }\r
             }\r
         } else if (this.ga === 'ga') {\r
             args.unshift('send');\r