In the process of simplifying my tools and respecting my users privacy I came back the the old way of doing website analytics. The access.log from our webserver has most of the data you need and no need to execute any Javascript client side.

I'm using the following command to analyze all the log files with GoAccess (even gzipped) and following the changes of the current access.log in order to have realtime updates.

tail -n 10000 -f access.log | zcat access.log.*.gz | goaccess access.log.1

Idea from: https://benhoyt.com/writings/replacing-google-analytics/