For me, it is important to see analytics about my portfolio website. This way, I can see which posts got the most views, which country my users are from, and which browser & operating system they are using.
The simplest solution to add analytics to your site is Google Analytics as it is free and easy to set up. But as we all know, this service is only free
as we pay it indirectly by providing data to it. What you need to know about Google Analytics and privacy.
I chose Umami because it
Umami does not provide a hosting solution. Therefore, we need to host the service on our own. All you need to get Umami up and running is a database (either MySQL or PostgreSQL) and a server that can run Node.js (10.13 or newer). Check the list of available hosting solutions.
I will show you two different approaches I tried to host Umami.
Running on Heroku
Heroku is a container-based cloud Platform as a Service (PaaS). Developers use Heroku to deploy, manage, and scale modern apps. The platform is elegant, flexible, and easy to use, offering developers the simplest path to getting their apps to market.
We can host Umami and a corresponding database for free on Heroku. The setup is well described in the Umami documentation.
To get it running, I just had to modify the npm
start script command to include the Heroku port:
"start": "next start -p $PORT"
Using Heroku is for sure the easiest & fastest way to set up a running Umami instance but there is one drawback: It is expensive.
I collected analytics data from my website for about 2 days and I quickly realized that the free “Hobby Dev” Heroku Postgres plan will not be enough.
This free plan includes 10,000 database rows and I filled ~1000 per day. So the free plan would be reached in about 10 days. The next “Hobby Basic” plan for 9$/month would include 10,000,000 rows which would last for approximately 27 years (assuming 1000 new rows per day, so no increasing traffic on my website). The “Standard 0” plan for 50$/month provides unlimited rows but this is way too much money I would spend for a self-hosted analytics solution.
Running on DigitalOcean & Vercel
Digital Ocean is an affordable cloud hosting provider. Starting with 5$/month you get a cloud server for personal use and can scale it up as needed. Using this link you get a $100 credit for the first 60 days.
I host a MySQL database on DigitalOcean which required these steps to set up:
- Initial setup the server with Ubuntu 18.04
- Install MySQL on Ubuntu
- Setup the MySQL database schema with the Umami MySQL schema
- Allow remote access to the database
Vercel is the company behind the framework Next.js which is used by Umami and they provide a free frontend hosting service. As you can imagine, it is really easy to deploy a Next.js application on Vercel as both applications are developed by the same company.
The setup is described in the official documentation.
If you now open the deployed Vercel app at
you need to perform these steps
- Add your website to Umami
- Add tracking code to your website
- Optional: Umami is also able to track events that occur on your website
This should result in a working private, open-source, self-hosted analytics solution:
I can sleep better as I now know that no more data is sent from my website to Google. I still have the possibility to track
my website analytics but in a simpler and privacy-focused way. Setting up Umami is quite easy if you are familiar with
software like Ubuntu and MySQL/Postgres.
Of course, I know need to pay some money to store this analytics data on my server but for me, it is worth the money.