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
}\r
\r
FluidbookStats.prototype = {\r
+\r
+\r
init: function () {\r
\r
var $this = this;\r
\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