summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2020-07-10 22:21:45 +0200
committerAki <please@ignore.pl>2020-07-10 22:21:45 +0200
commit9f5774643bcc9796b4a3a537a8f7478dc8a87dac (patch)
tree81305c8262d0b1bc970dea62cd991fbc060b0cbd
parentb245f4555ef4a4543c40a4d790cba6cb640823d1 (diff)
downloadstats-master.zip
stats-master.tar.gz
stats-master.tar.bz2
Changed to use beacon apiHEADmaster
-rw-r--r--track.js6
1 files changed, 1 insertions, 5 deletions
diff --git a/track.js b/track.js
index 5b0e544..cc2df6f 100644
--- a/track.js
+++ b/track.js
@@ -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,