2024-02-25 21:50:41 +03:00
|
|
|
<!-- Display GoatCounter pageviews -->
|
|
|
|
<script>
|
|
|
|
let pv = document.getElementById('pageviews');
|
|
|
|
|
|
|
|
if (pv !== null) {
|
|
|
|
const uri = location.pathname.replace(/\/$/, '');
|
|
|
|
const url = `https://{{ site.analytics.goatcounter.id }}.goatcounter.com/counter/${encodeURIComponent(uri)}.json`;
|
|
|
|
|
|
|
|
fetch(url)
|
|
|
|
.then((response) => response.json())
|
|
|
|
.then((data) => {
|
2024-05-18 13:52:45 +03:00
|
|
|
const count = data.count.replace(/\s/g, '');
|
|
|
|
pv.innerText = new Intl.NumberFormat().format(count);
|
2024-02-25 21:50:41 +03:00
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
pv.innerText = '1';
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|