Add traffic analytics to your quarto blog

quarto
Author

Teresa Kubacka

Published

November 9, 2022

I have recently added lightweight traffic analytics to this blog. I decided not to go for Google Analytics, but use one of the free, open-source, privacy-conscious options instead. I went with GoatCounter. To set up traffic analytics with GoatCounter is quite easy:

To integrate the GoatCounter tracking script in the Quarto blog, I used the solution which I found on Danielle Navarro’s blog:

<script data-goatcounter="https://HERE_YOUR_GOATCOUNTER_ACCOUNT_NAME.goatcounter.com/count"
        async src="//gc.zgo.at/count.js"></script>
format:
  html:
    include-after-body: traffic.html

That’s it! Now the GoatCounter script will be embedded in all the pages on the blog.

If you are using another tracking provider, Quarto has a tutorial how to switch on cookies and embed your own script.