From: Vincent Vanwaelscappel Date: Tue, 2 Jun 2020 12:51:33 +0000 (+0200) Subject: wip #3675 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=ff46357c2b73501721ebfef3158862dd145397fa;p=fluidbook-html5.git wip #3675 @0.5 --- diff --git a/js/libs/fluidbook/fluidbook.stats.js b/js/libs/fluidbook/fluidbook.stats.js index b729848a..fcb9ed71 100644 --- a/js/libs/fluidbook/fluidbook.stats.js +++ b/js/libs/fluidbook/fluidbook.stats.js @@ -8,6 +8,7 @@ function FluidbookStats(fluidbook) { if (this.fluidbook.settings.googleAnalytics !== '') { this.ga = 'gtag'; this.gaCodes = this.fluidbook.settings.googleAnalytics.split(','); + gtag('js', new Date()); $.each(this.gaCodes, function (k, code) { gtag('config', code, {'send_page_view': false}); }); @@ -47,6 +48,8 @@ FluidbookStats.prototype = { return; } + console.log('trackGoogleAnalytics',type,page,extra); + var url = location.pathname + location.search + location.hash switch (type) { @@ -102,7 +105,7 @@ FluidbookStats.prototype = { _ga: function (a0, a1, a2, a3, a4) { var args = Array.prototype.slice.call(arguments); - if (this.ga == 'gtag') { + if (this.ga === 'gtag') { var f, o, c, a; o = {}; if (a0 === 'pageview') { @@ -127,7 +130,7 @@ FluidbookStats.prototype = { } else { gtag(f, a, o); } - } else if (this.ga == 'ga') { + } else if (this.ga === 'ga') { args.unshift('send'); window['ga'].apply(null, args); }