aboutsummaryrefslogtreecommitdiff
path: root/static/js/pageview_timer.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/js/pageview_timer.js')
-rw-r--r--static/js/pageview_timer.js31
1 files changed, 0 insertions, 31 deletions
diff --git a/static/js/pageview_timer.js b/static/js/pageview_timer.js
deleted file mode 100644
index 2761396..0000000
--- a/static/js/pageview_timer.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- Hi,
-
- If you are reading this, you have found this script in the referenced scripts
- for pages on this site. I know you're gonna have to take me at my word on this,
- but I'm literally using this to collect how much time people spend reading my
- webpages. See metrics here: https://christine.website/metrics
-
- If you have the "do not track" setting enabled in your browser, this code will
- be ineffectual.
-*/
-
-(function() {
- let dnt = navigator.doNotTrack;
- if (dnt === "1") {
- return;
- }
-
- let startTime = new Date();
-
- function logTime() {
- let stopTime = new Date();
- window.navigator.sendBeacon("/api/pageview-timer", JSON.stringify({
- "path": window.location.pathname,
- "start_time": startTime.toISOString(),
- "end_time": stopTime.toISOString()
- }));
- }
-
- window.addEventListener("pagehide", logTime, false);
-})();