update goatcounter

This commit is contained in:
Daniel Bulant 2022-08-10 20:37:38 +02:00
parent bc512c194f
commit 042f823670
3 changed files with 14 additions and 2 deletions

View file

@ -17,7 +17,7 @@
<script type="module" src="/build/main.js"></script>
<script src="https://unpkg.com/web-streams-polyfill/dist/polyfill.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/streamsaver@2.0.5/StreamSaver.min.js"></script>
<script data-goatcounter="https://manga.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
<script data-goatcounter="https://manga.goatcounter.com/count" src="//gc.zgo.at/count.js"></script>
</head>
<body>

View file

@ -20,7 +20,7 @@
"build:static": "spank",
"serve": "spassr --ssr",
"rollup": "rollup -cw",
"nollup": "nollup -c --verbose",
"nollup": "nollup -c --verbose --host 0.0.0.0",
"routify": "routify"
},
"devDependencies": {

View file

@ -1,5 +1,17 @@
<script>
import { logs } from "../util/logs";
import { afterPageLoad } from "@roxi/routify";
let skipFirst = true;
$afterPageLoad(page => {
if(skipFirst) return skipFirst = false;
if(window.goatcounter) window.goatcounter.count({
path: page.path,
title: page.title,
referrer: page.prev.path
});
else console.warn("Page change; GoatCounter not loaded (yet?)", page.path);
})
</script>
<!-- routify:options preload="proximity" -->