From 2cdcdd979a182c89cb34d59b73ec0963d215e909 Mon Sep 17 00:00:00 2001 From: Daniel Bulant Date: Sun, 25 Sep 2022 15:25:55 +0200 Subject: [PATCH] fix analytics --- src/pages/_layout.svelte | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pages/_layout.svelte b/src/pages/_layout.svelte index 049a410..c390b23 100644 --- a/src/pages/_layout.svelte +++ b/src/pages/_layout.svelte @@ -3,14 +3,16 @@ import { afterPageLoad } from "@roxi/routify"; let skipFirst = true; + let last = window.location.pathname; $afterPageLoad(page => { if(skipFirst) return skipFirst = false; if(window.goatcounter) window.goatcounter.count({ - path: page.path, + path: window.location.pathname, title: page.title, - referrer: page.prev.path + referrer: last }); - else console.warn("Page change; GoatCounter not loaded (yet?)", page.path); + else console.warn("Page change; GoatCounter not loaded (yet?)", window.location.pathname); + last = window.location.pathname; })