diff options
-rw-r--r-- | track.js | 6 |
1 files changed, 1 insertions, 5 deletions
@@ -12,11 +12,7 @@ scrolledTo = Math.max(scrolledTo, window.scrollY + window.innerHeight) }, false) window.addEventListener("beforeunload", ()=>{ - let xhr = new XMLHttpRequest() - startedAt = startedAt || new Date() - xhr.open("POST", "https://stats.ignore.pl/entry") - xhr.setRequestHeader("Content-Type", "application/json") - xhr.send(JSON.stringify({ + navigator.sendBeacon("https://stats.ignore.pl/entry", JSON.stringify({ "location": document.location.href, "referrer": document.referrer, "startedAt": startedAt, |