Skip to content

Commit 4863d26

Browse files
theproteinbotclaude
andcommitted
feat(web): add GoatCounter visit tracking with footer counter
Add GoatCounter analytics script (privacy-friendly, no cookies) and display visit count in the footer via GoatCounter's public JSON API. Counter gracefully hides if the API is unreachable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c696216 commit 4863d26

7 files changed

Lines changed: 52 additions & 23 deletions

File tree

catpred/web/frontend/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
<body>
2020
<div id="app"></div>
2121
<script type="module" src="/src/main.ts"></script>
22+
<script data-goatcounter="https://catpred.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
2223
</body>
2324
</html>

catpred/web/frontend/src/components/AppFooter.vue

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
<script setup lang="ts">
2+
import { ref, onMounted } from 'vue'
3+
4+
const visitCount = ref<string | null>(null)
5+
6+
onMounted(async () => {
7+
try {
8+
const res = await fetch('https://catpred.goatcounter.com/counter/TOTAL.json')
9+
if (res.ok) {
10+
const data = await res.json()
11+
visitCount.value = data.count_unique ?? data.count ?? null
12+
}
13+
} catch {
14+
// silently ignore — counter just won't show
15+
}
16+
})
17+
</script>
18+
119
<template>
220
<footer class="footer">
321
<div class="container footer-inner">
@@ -8,6 +26,7 @@
826
<a href="https://www.maranasgroup.com/" target="_blank" rel="noreferrer" class="footer-link">Maranas Group</a>
927
at Penn State
1028
</p>
29+
<p v-if="visitCount" class="visit-count">{{ visitCount }} visits</p>
1130
</div>
1231
</footer>
1332
</template>
@@ -48,4 +67,12 @@
4867
color: var(--accent);
4968
border-bottom-color: var(--accent);
5069
}
70+
71+
.visit-count {
72+
margin-top: 0.25rem;
73+
font-family: var(--font-mono);
74+
font-size: 0.7rem;
75+
color: var(--text-tertiary);
76+
opacity: 0.7;
77+
}
5178
</style>

catpred/web/static/dist/assets/index--vkmdqN7.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

catpred/web/static/dist/assets/index-B_EBo3Xr.js

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

catpred/web/static/dist/assets/index-C3Gjkhgi.css

Lines changed: 0 additions & 1 deletion
This file was deleted.

catpred/web/static/dist/assets/index-DOG0cTDK.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

catpred/web/static/dist/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Newsreader:ital,opsz,wght@0,6..72,300;0,6..72,400;1,6..72,300;1,6..72,400&family=IBM+Plex+Mono:wght@400;500&display=swap"
1616
rel="stylesheet"
1717
/>
18-
<script type="module" crossorigin src="/static/dist/assets/index--vkmdqN7.js"></script>
19-
<link rel="stylesheet" crossorigin href="/static/dist/assets/index-C3Gjkhgi.css">
18+
<script type="module" crossorigin src="/static/dist/assets/index-B_EBo3Xr.js"></script>
19+
<link rel="stylesheet" crossorigin href="/static/dist/assets/index-DOG0cTDK.css">
2020
</head>
2121
<body>
2222
<div id="app"></div>
23+
<script data-goatcounter="https://catpred.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
2324
</body>
2425
</html>

0 commit comments

Comments
 (0)