This guide will show you how to:
- Add a Google Analytics alternative,
Simple Analytics
, to a quarto website.
Introduction
When I started this blog I did not want to add site analytics. Partly because I do not feel this is important as a small blogging site. But mostly because I personally find user tracking, at the very least, an ethically grey area. It is certainly useful to help gain feedback on the extent, relevance, and engagement of online content. However, this is not without its bad side, in the context of spider-web-like marketing campaigns and user tracking with little to no care for privacy.
The position is also quite tricky when it comes to using quarto (which this blogging site uses). It is an excellent tool for scientific writing and website development, but right now it only provides easy integration for Google Analytics. Having only this single option is far from ideal. It supports a monopoly towards an already powerful tech giant who also share user data with third parties for monetary purposes.
After some online research, my decision on site analytics changed thanks to a viable alternative option. This post looks to share another, privacy-focused, approach to site analytics when using quarto… Step forward Simple Analytics
!
What is Simple Analytics?
Simple Analytics describe themselves as:
“A privacy-first Google Analytics alternative.”
They comply with a range of privacy policies, including GDPR, whilst using no site cookies and storing no personal details. Their documentation is excellent, giving very detailed insights into their approaches and the metrics they calculate. They also have a thorough comparison with Google Analytics and have open-sourced their analytics scripts. The dashboard and analytics they provide is clean, concise, and simple to use - an live demo is hosted on their website. Finally, I think their pricing structure is fair, with a free tier, options for students, and a range of paid tiers to suit different needs.
Putting all this together, with a strong focus on user privacy and pulling on the heart strings of my inner-geek, introducing Simple Analytics to this site was a no-brainer! If you have a site that uses analytics (especially one built with quarto) I hope this article resonates with you as discovering Simple Analytics did for me!
Adding Simple Analytics to quarto Websites
Do not directly copy the example .html
and _quarto.yml
files linked within this section without checking the Simple Analytics documentation first. Always revert back to and use the latest installation script syntax shared by Simple Analytics to remain up-to-date. The links to the heuristic-pedals
GitHub repo home
are purely shared for example purposes only.
The following instructions show how to add Simple Analytics to a Quarto Website:
- Go to the Simple Analytics documentation script set-up page and copy the HTML/java snippet.
- Create a new
.html
file and add the HTML/java snippet. - In your
_quarto.yml
configuration file, add the relative file path to the newly created HTML file in step 2, at theformat > HTML > include-after-body
location. - Commit and deploy these changes to your site.
- Create a Simple Analytics log-in and then follow the on-screen instructions to add your domain to your account.
As the last stage of step 5, Simple Analytics will search for the presence of this script in your website. Within a few minutes you will be set-up and ready to go 🥳
For a firsthand demonstration of steps 2 and 3, you can check out example .html
and _quarto.yml
files within in the GitHub repo used for this site.