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",
"version": "0.92.0",
"version": "0.96.0",
"description": "A simple, fast, website analytics alternative to Google Analytics. ",
"author": "Mike Cao <mike@mikecao.com>",
"license": "MIT",

View File

@ -110,7 +110,7 @@ import { removeTrailingSlash } from '../lib/url';
const addEvents = () => {
document.querySelectorAll("[class*='umami--']").forEach(element => {
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 listener = () => trackEvent(value, type);