fix: ensure pageviews are fetched after DOM is loaded (#2071)
This commit is contained in:
parent
2966fc174d
commit
b4019f3517
1 changed files with 8 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
|||
<!-- Display GoatCounter pageviews -->
|
||||
<script>
|
||||
let pv = document.getElementById('pageviews');
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const pv = document.getElementById('pageviews');
|
||||
|
||||
if (pv !== null) {
|
||||
const uri = location.pathname.replace(/\/$/, '');
|
||||
|
@ -16,4 +17,5 @@
|
|||
pv.innerText = '1';
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue