Hello guys, today I am here to share with you a project that I've made recently, it is Analytics Box - A simple privacy focused analytics in Golang.
Analytics box is analytics tool like google analytics but instead of ripping user's privacy off them like google it respects their privacy and doesn't collect any unnecessary information.
- No Cookies.
- Forgets user in 24 hours so even if wish to know user's private info you can't.
- Can track unique page views effectively without hurting user's privacy.
- Custom events available.
- Super simple to setup. ( 1 go binary + 1 super small script on frontend ).
- Super low resource consumption.
- Dashboard is decoupled from the tool so you can use any tool ( like Metabase for visualization of data ).
- Supports multiple SQL database.
We identify users uniquely by creating a hash and storing it in a Redis database along with a UUID which automatically deletes itself in 24 hours.
hash = md5( raw_public_ip + browser_name + operating_system + date + secret)
It generates a 32 character long string with is stored in database along with a UUID and it is only valid for a day.
Parameters used in hash have the following reasons,
- IP - to identify user ( It may be a public IP like café or a user's own IP )
- Browser - So if user changes his/her browser we forget it. Operating System - So if user changes its device we forget him.
- Date - So we forget user daily.
- Secret - Here comes the most important part we while production recommend to use a UUID that isn't logged anywhere so even if want to view user's private info you can't, but while development use a hardcoded string as you restart server many times and it will generate false unique visitors.
There are many privacy friendly analytics tool but here are some points that makes it special.
- It is written in go so you can but it on the same server as your app as it uses nearly to negligible amount of resource ( in large schema of things ).
- It is written in go fiber which can handle a by lot I mean around 35,000 requests per second ( as per their website).
- It currently supports PostgreSQL and in future I plan to add support for Clickhouse because of its amazing performance, and I will continue to keep postgres supported for as long as possible because of its low resource consumption it would be a great tool for small websites like blogs, like one that, I have though it hasn't been updated for a while now.
- I don't plan to convert it into a SaaS application ( at least in near future ) as I don't want to make another SaaS privacy focused analytics app as there are already many good in market. I'm making this in a way that you can get most insights from your data so it doesn't have a dashboard ( use something like Metabase for it here are some screenshots of dashboard that I build within 3-4 minutes while writing this readme and I'm no profession and it on par with what SaaS provides apps provides to you) with complete control over your data and it can run on simple commodity hardware for a long period of time without any manual Interventions.
There are many privacy friendly analytics tools and they have a dashboard built in as most of them are SaaS application but this isn't gonna be a SaaS app so in order to make most sense out of the data we recommend users to use something like Metabase as even a non-techie can make custom charts and if you are a techie then you can make even more sense of data by writing custom SQL Queries to obtain and visualize data.
The Images you saw above were made within 3-4 minutes while I was writing README for GitHub repo, and it was auto generated I just changed its sizes and names that's it. So we have made a conscious decision to decouple analytics tool and dashboard for it.