Deployed on 2024-05-08T16:21:13-05:00

This commit is contained in:
Dan Jones 2024-05-08 16:21:13 -05:00
commit 40aa4343a7
2 changed files with 10 additions and 6 deletions

12
app.js
View file

@ -5,26 +5,30 @@ document.addEventListener('click', getFollows);
function getFollows(evt) {
const el = evt.target;
if (el.tagName.toLowerCase() !== 'a') {
return;
return true;
}
const name = el.dataset.name;
if (!name) {
return;
return true;
}
const url = el.href;
if (!url) {
return;
return true;
}
if (!window.umami) {
return;
return true;
}
const umProm = umami.trackEvent('visit', { type: 'click', site: name });
if (!umProm) {
return true;
}
if (!el.target || el.target.match(/^_(self|parent|top)$/i)) {
// If we're not opening in a new tab, then try to send event before navigating away
// Don't wait too long though (half a second, at most)