diff --git a/app.js b/app.js index 4a22048..6e75657 100644 --- a/app.js +++ b/app.js @@ -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) diff --git a/index.html b/index.html index 2bfae35..076a97c 100644 --- a/index.html +++ b/index.html @@ -5,9 +5,9 @@ Dan Jones's Links - + - +