Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Update className check in tracker.

Mike Cao698d4d2687b7
diff --git a/tracker/index.js b/tracker/index.js
index 5d537d2c3..97976ec0a 100644
--- a/tracker/index.js
+++ b/tracker/index.js
@@ -114,17 +114,16 @@ import { removeTrailingSlash } from '../lib/url';
};
const addEvent = element => {
- element.className &&
- element.className.split(' ').forEach(className => {
- if (!eventClass.test(className)) return;
+ (element.getAttribute('class') || '').split(' ').forEach(className => {
+ if (!eventClass.test(className)) return;
- const [, type, value] = className.split('--');
- const listener = listeners[className]
- ? listeners[className]
- : (listeners[className] = () => trackEvent(value, type));
+ const [, type, value] = className.split('--');
+ const listener = listeners[className]
+ ? listeners[className]
+ : (listeners[className] = () => trackEvent(value, type));
- element.addEventListener(type, listener, true);
- });
+ element.addEventListener(type, listener, true);
+ });
};
const monitorMutate = mutations => {