Getting started is pretty easy, just add the following JavaScript anywhere on the page:
<script data-goatcounter="https://MYCODE.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>
Check if your adblocker is blocking GoatCounter if you don’t see any pageviews (goatcounter.com and/or gc.zgo.at domain).
const script = document.createElement('script'); script.setAttribute('defer', true); script.setAttribute('src', 'https://gc.zgo.at/count.js'); script.setAttribute('data-goatcounter', 'https://MYCODE.goatcounter.com/count'); document.body.appendChild(script);
Here are some things you may want to look at after setting up the above:
Make sure GoatCounter is allowed in the Content-Security-Policy if you’re using it.
If you’re not seeing any pageviews then chances are your browser’s adblocker is blocking it. Disable it and check again. It can take about 10 seconds for pageviews to appear, but this should never be longer.
You may want to consider adding a canonical link, for example:
<link rel="canonical" href="https://example.com/path.html">
See Control the path that’s sent to GoatCounter for more details.
Prevent tracking my own pageviews? documents some ways you can ignore your own pageviews from showing up in the dashboard.
Feel free to get in touch if you’ve got any questions or having any problems; a lot of times they can be resolved without too much problems.
Ways to contact me: show