mirror of
https://github.com/umami-software/umami.git
synced 2026-02-20 04:25:39 +01:00
Make custom pageview data attribute prefix shorter
Since we're on the script element, no need to namespace the attribute with "umami", using data-event-* is enough
This commit is contained in:
parent
1fd997c374
commit
f45f7f5819
1 changed files with 3 additions and 2 deletions
|
|
@ -26,6 +26,7 @@
|
|||
const endpoint = `${root}/api/send`;
|
||||
const screen = `${width}x${height}`;
|
||||
const eventRegex = /data-umami-event-([\w-_]+)/;
|
||||
const pageviewCustomPropertyRegex = /data-event-([\w-_]+)/;
|
||||
const eventNameAttribute = _data + 'umami-event';
|
||||
const delayDuration = 300;
|
||||
|
||||
|
|
@ -41,9 +42,9 @@
|
|||
|
||||
const getPageviewEventData = () => Object.fromEntries(
|
||||
[...currentScript.attributes]
|
||||
.filter(attribute => eventRegex.match(attribute.name))
|
||||
.filter(attribute => pageviewCustomPropertyRegex.match(attribute.name))
|
||||
.map(attribute => {
|
||||
const match = attribute.name.match(eventRegex);
|
||||
const match = pageviewCustomPropertyRegex.match(attribute.name);
|
||||
return [match[1], attribute.value]
|
||||
})
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue