forked from cadey/xesite
kill pageview timer experiment (#83)
This commit is contained in:
parent
f7327f2d5a
commit
42556bb678
|
@ -70,3 +70,10 @@ benefit in that timespan, I will disable this and post a follow-up explaining ho
|
||||||
I believe it wasn't useful.
|
I believe it wasn't useful.
|
||||||
|
|
||||||
Thanks and be well.
|
Thanks and be well.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
EDIT 2019-10-15: browsers disable this call from the context I am using and I don't
|
||||||
|
really care enough to figure out how to fix it. This experiment is over. Thank you
|
||||||
|
to everyone that participated. All data will be scrubbed and a followup will be
|
||||||
|
posted soon.
|
||||||
|
|
|
@ -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);
|
|
||||||
})();
|
|
|
@ -5,7 +5,7 @@ self.addEventListener('install', function(event) {
|
||||||
event.waitUntil(preLoad());
|
event.waitUntil(preLoad());
|
||||||
});
|
});
|
||||||
|
|
||||||
const cacheName = "cache-2019-05-21";
|
const cacheName = "cache-2019-10-15";
|
||||||
|
|
||||||
var preLoad = function(){
|
var preLoad = function(){
|
||||||
console.log('[PWA Builder] Install Event processing');
|
console.log('[PWA Builder] Install Event processing');
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
|
|
||||||
<link rel="canonical" href="https://christine.website/{{ .Link }}">
|
<link rel="canonical" href="https://christine.website/{{ .Link }}">
|
||||||
|
|
||||||
<!-- Metrics -->
|
|
||||||
<script src="/static/js/pageview_timer.js"></script>
|
|
||||||
|
|
||||||
<script type="application/ld+json">
|
<script type="application/ld+json">
|
||||||
{
|
{
|
||||||
"@context": "http://schema.org",
|
"@context": "http://schema.org",
|
||||||
|
|
Loading…
Reference in New Issue