Setting up Umami
I have been using Google Analytics on my blog for a while now. Looking at the little traffic I get, it doesn’t really require any website analytics. Still, it is good motivation to see at least some people reading the blog. It also tells me which posts tend to be read the most and from which sources I get page views (Twitter, LinkedIn, Facebook, Direct, etc).
I recently came across umami, an open-source alternative to Google Analytics. It showed up on GitHub in the “Explore repositories” sidebar. I looked over the demo and decided to try it. Umami is self-hosted, so I needed to have a server setup. Luckily, I had some credits in my DigitalOcean account and started a droplet to work on.
The umami documentation has a separate page for a DigitalOcean setup, which made the installation very easy. At first, I tried installing it from source (installing node, building with npm etc.) but I kept running into one error or another. After a few tries, I gave in to using the docker method. It took only one command docker-compose up
. This started containers for the umami application and a Postgres database and had the app running on port 3000.
Now, I had to setup Nginx. Nginx routes all the incoming HTTP/HTTPS requests to the local port (3000 in this case). The config looks like this
server {
server_name umami.parth-paradkar.me www.umami.parth-paradkar.me;
location / {
proxy_pass http://localhost:3000;
}
}
Here, there are two subdomains as the certbot requires it (For generating certificates using Let’s Encrypt). SSL certificate is required since the browser requires the tracking JS file (umami.js
) to be served over HTTPS.
Before generating the certificates though, I had to register the subdomains for accessing the umami application. For this, I added two A records in my domain name config for parth-paradkar.me
, each pointing to the server at which umami is running.
Now that the subdomains are setup, certbot can generate the certificates.
After the SSL certificates were added, the site was up and running at https://umami.parth-paradkar.me !
Some pros and cons:
Pros:
- It is FOSS- As umami is open sourced, I can freely download it and modify it acording to my needs.
- Simpler, cleaner UI.
- Self-hosted: This gives me more control over the stored data through direct access to the database.
- Manually configuration for tracking specific events.
Cons:
- Technically, I need to pay for it since I need to keep it running on a server.
- Not as feature-rich as Google Analytics.