]> _ Git - cubist_gtag.git/commitdiff
wip #3037 @0:15
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 12 Sep 2019 08:23:57 +0000 (10:23 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 12 Sep 2019 08:23:57 +0000 (10:23 +0200)
resources/public/js/gtag.js

index c0297300312bd4ed26302b11f358293123206ee1..4719ae0e7ed966b19abe66813873b72a395c53c2 100644 (file)
@@ -1,3 +1,7 @@
+var matches = function matches(element, selector) {
+    return element.matches ? element.matches(selector) : element.msMatchesSelector ? element.msMatchesSelector(selector) : element.webkitMatchesSelector ? element.webkitMatchesSelector(selector) : null;
+};
+
 function cubistga() {
     this.initEvents();
 }
@@ -11,7 +15,7 @@ cubistga.prototype.initEvents = function () {
     });
 
     document.addEventListener('click', function (e) {
-        if (e.target.matches('a[data-ga]')) {
+        if (matches(e.target,'a[data-ga]')) {
             $this.handleGtag(e.target);
         }
         if (e.target.closest('a[data-ga]')) {