mirror of
https://github.com/umami-software/umami.git
synced 2026-02-14 17:45:38 +01:00
Script simplification: Greatly clarify element tracking logic
This commit is contained in:
parent
671dcfceb5
commit
b26fc15fa0
1 changed files with 10 additions and 12 deletions
|
|
@ -112,24 +112,22 @@
|
||||||
const eventName = parentElement.getAttribute(eventNameAttribute);
|
const eventName = parentElement.getAttribute(eventNameAttribute);
|
||||||
if (!eventName) return;
|
if (!eventName) return;
|
||||||
|
|
||||||
if (parentElement.tagName === 'A') {
|
if (parentElement.tagName === 'BUTTON') {
|
||||||
|
return trackElement(parentElement);
|
||||||
|
}
|
||||||
|
if (parentElement.tagName === 'A' && href) {
|
||||||
const external =
|
const external =
|
||||||
target === '_blank' ||
|
target === '_blank' ||
|
||||||
e.ctrlKey ||
|
e.ctrlKey ||
|
||||||
e.shiftKey ||
|
e.shiftKey ||
|
||||||
e.metaKey ||
|
e.metaKey ||
|
||||||
(e.button && e.button === 1);
|
(e.button && e.button === 1);
|
||||||
|
if (!external) e.preventDefault();
|
||||||
if (eventName && href) {
|
return trackElement(parentElement).then(() => {
|
||||||
if (!external) e.preventDefault();
|
if (!external) {
|
||||||
return trackElement(parentElement).then(() => {
|
(target === '_top' ? top.location : location).href = href;
|
||||||
if (!external) {
|
}
|
||||||
(target === '_top' ? top.location : location).href = href;
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (parentElement.tagName === 'BUTTON') {
|
|
||||||
return trackElement(parentElement);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue