Fix tracker regex for events.

This commit is contained in:
Mike Cao 2020-10-13 18:40:15 -07:00
parent 56ccdf8c8e
commit e0a7fd9ec4
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "umami", "name": "umami",
"version": "0.92.0", "version": "0.96.0",
"description": "A simple, fast, website analytics alternative to Google Analytics. ", "description": "A simple, fast, website analytics alternative to Google Analytics. ",
"author": "Mike Cao <mike@mikecao.com>", "author": "Mike Cao <mike@mikecao.com>",
"license": "MIT", "license": "MIT",

View File

@ -110,7 +110,7 @@ import { removeTrailingSlash } from '../lib/url';
const addEvents = () => { const addEvents = () => {
document.querySelectorAll("[class*='umami--']").forEach(element => { document.querySelectorAll("[class*='umami--']").forEach(element => {
element.className.split(' ').forEach(className => { element.className.split(' ').forEach(className => {
if (/^umami--([a-z]+)--([a-z0-9_]+[a-z0-9-_]+)$/.test(className)) { if (/^umami--([a-z]+)--([\w]+[\w-]*)$/.test(className)) {
const [, type, value] = className.split('--'); const [, type, value] = className.split('--');
const listener = () => trackEvent(value, type); const listener = () => trackEvent(value, type);