Fix counter.dev analytics (#674)

This commit is contained in:
Emruz Hossain 2022-10-18 22:06:22 +06:00 committed by GitHub
parent 0e8e182e33
commit 33c10915a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,26 +10,10 @@
<!-- Counter.dev -->
{{ with .counterDev }}
<script>
if (
!sessionStorage.getItem("_swa") &&
document.referrer.indexOf(location.protocol + "//" + location.host) !== 0
) {
fetch(
"https://counter.dev/track?" +
new URLSearchParams({
referrer: document.referrer,
screen: screen.width + "x" + screen.height,
user: "{{ .id }}",
utcoffset: "1",
}),
{{ with .referrerPolicy }}
{ referrerPolicy: "{{ . }}" }
{{ end }}
);
}
sessionStorage.setItem("_swa", "1");
</script>
<script src="https://cdn.counter.dev/script.js"
data-id="{{ .id }}"
data-utcoffset="1"
></script>
{{ end }}
<!-- GoatCounter -->