This commit is contained in:
Joshua Seigler 2025-07-03 01:34:13 -04:00
parent 3ec97697bb
commit 45680e24e3
146 changed files with 111 additions and 46 deletions

View file

@ -58,8 +58,20 @@ function addEffect({ target }: UIEvent) {
})
}
function attend({ target}: UIEvent) {
if (!isElement(target) || !target.matches("a[href][target=_blank]")) {
return
}
umami?.track(`Link: ${target['innerText'] ?? target.getAttribute('href')}`, {
from: document.location,
destination: target.getAttribute('href'),
})
}
document.addEventListener("mouseenter", addEffect, true)
document.addEventListener("focus", addEffect, true)
document.addEventListener("mouseleave", removeEffect, true)
document.addEventListener("blur", removeEffect, true)
document.addEventListener("click", attend, true)