Following this thread about removing google analytics, I tried plausible.io
Great job, and this is how to simply track simple events (after the very simple general setup well describe on their doc).
For example click on a link :
<script>
function myClickEvent() {
plausible('myClickEvent');
}
</script>
<a href="link" onclick="myClickEvent()"> My Click Label </a>
The great part is you can process the name of your ClickEvent with hugo variables.
Just avoid using -
in the function name.
For example:
<script>
function SectionName{{ .SomeVariable | safeJS }}About() {
plausible('SectionName{{ .SomeVariable | safeJS }}About');
}
</script>
HTH.