From: Vincent Vanwaelscappel Date: Tue, 24 Sep 2019 17:11:11 +0000 (+0200) Subject: try #3065 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=a7a684cc222505e8666532bc772c0852c32f86ec;p=pmi.git try #3065 @0.5 --- diff --git a/resources/js/vendor/cubist/gtag/gtag.js b/resources/js/vendor/cubist/gtag/gtag.js index be69a03..2d33eae 100644 --- a/resources/js/vendor/cubist/gtag/gtag.js +++ b/resources/js/vendor/cubist/gtag/gtag.js @@ -43,7 +43,7 @@ cubistga.prototype.event = function (action, category, label, value, noninteract if (noninteraction === undefined) { noninteraction = false; } - if (options === undefined) { + if (options === undefined || options === null) { options = {}; } options.non_interaction = noninteraction; @@ -56,10 +56,7 @@ cubistga.prototype.event = function (action, category, label, value, noninteract if (undefined !== value && null !== value) { options.value = value; } - - //console.log('gtag event', action, options); - - return (typeof gtag !== "undefined") ? gtag('event', action, options) : false; + return gtag('event', action, options) }; cubistga.prototype.handleGtag = function (el) { @@ -70,11 +67,7 @@ cubistga.prototype.handleGtag = function (el) { let value = el.getAttribute('data-ga-value'); let options = el.getAttribute('data-ga-options'); if (options !== null) { - try { - options = JSON.parse(options); - }catch (e) { - options={}; - } + options = JSON.parse(options); } return this.event(action, category, label, value, el.getAttribute('data-ga-noninteraction') === 1, options);