]> _ Git - pmi.git/commitdiff
try #3065 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 24 Sep 2019 17:11:11 +0000 (19:11 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 24 Sep 2019 17:11:11 +0000 (19:11 +0200)
resources/js/vendor/cubist/gtag/gtag.js

index be69a0369238291b3129c1eb8d46603a82f72977..2d33eae579759dae7ac966d282312abf6abccd5f 100644 (file)
@@ -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);