Plausible analytics: Self-hosted analytics for free
Plausable analytics is self-hosted Google Analytics. Free and easy to host.
It is getting harder and harder to justify the use of Google Analytics for my sites. It is often blocked by ad blockers and "do not track"-plugins. You don't have control of the data. It is even facing some legal issues in the EU. There are some good alternatives out there however the solves most issues. One of them is Plausible Analytics.
If you have ever used Google Analytics then you probably noticed that it is quite complicated. It tracks hundreds of metrics and can be quite daunting to use. Plausible takes a different approach and only saves the most important metrics. Essentials include basic metrics such as:
- Unique visitors
- Page views
- Sources, with Google keyword tracking
- Top/entry/exit pages
- Geographical tracking (country map)
- Bounce rates and visit duration
You can also set conversion goals like in Google Analytics. Compare this to the >200 metrics available in Google Analytics and Plausible might seem basic. It is however great for the basics and the dashboard looks great out of the box. You no longer have to take a Udemy course to understand how it works.
Installation and hosting
Plausible is an Elixir web application using the Phoenix framework. It has two external dependencies: PostgreSQL for the application and Clickhouse for storing the actual traffic data.
You don't need to mess around with this yourself however as there are templates for both Docker Compose and Kubernetes. I don't use Kubernetes for my own self hosting setup so I went with the Docker Compose one. There are a few things to configure and you probably need a reverse proxy in front of the application. I went with Nginx. It took me about 30 minutes to have it up and running. 5 minutes after that I had it receive analytics from my applications. All in all the setup was a treat. This excludes updates and backup however.
It is quite lightweight as well. It is using about 300Mb of RAM on my server. None of the websites that I track using Plausible receive a lot of traffic, so I can't speak about CPU usage.
Graphing with Grafana and others
One the great things about having self hosted analytics is that you no longer have to worry about how to access your data. The data is stored in a Clickhouse database and available just like any database. You can access it through Clickhouse clients. Or, do what I did and connect it to Grafana. I now have graphs of my traffic right next to other metrics. Very nice. There is a plugin to access Google Analytics from Grafana as well but having full access to your own metrics is still a great thing.
If you're running Plausible Analytics in Docker Compose and your Grafana stack then this is simple. All you need to do is make sure the containers are using the same network. Check out the official documentation for Docker Compose to find out more.
Cool things you can do
Having your analytics data available in Clickhouse means that you can now query it using SQL. This opens up a whole new world of possibilities. You can for example use this data to have a "recommended reading" section in your blog based on analytics from Plausible.
You might even be able to use Hasura in the future to generate REST and GraphQL APIs for your analytics data. Then you can simple use those APIs for features such as the recommended section mentioned above. If your blog is server-side based then you can of course just connect to the Clickhouse database directly.
Paying or self-hosting
As always it is important to note that self-hosting is not free unless you have unlimited time and patience. The server costs for Plausible may be low but these things add up. You are now also responsible for keeping things updated and secure. In my experience it is often very easy to get these kinds of projects running but not so much when it comes to updating.
For example, I had to do a completely fresh install of Ghost to upgrade to version 4. The update stopped working and the import feature from the older version refused to accept the file. That took a solid day or so to do.
If you have a modest blog with 100k pageviews a month then you are looking at about $19 for the hosted version. That also includes email and such so you don't have to setup your own third party email solution. Keep in mind however that you then lose the ability to extract the data from Clickhouse directly. So no fancy graphing in Grafana.
Which is better? It is up to you as usual but I went with the self-hosted version.
One of these articles is not complete without a list of alternatives.
Matomo is a very popular one. It has more features than Plausible such as A/B testing, forms, and a tag manager. Many of these features are however only included in the hosted version. If you want them for the self-hosted version then you have to pay an annual fee for each feature which is kind of strange. A/B testing for example is €199 a year. That is more than the entire hosted version if you have less than 1 million pageviews a month. The hosted version includes ALL of these extra features too. I think the reason for this is that the self-hosted version is less for people like me and more for those who need to have these things on-premises.
Still, the base version has all the basics so you might as well take a look at that one as well.
Much like Plausible it has a self-hosted version and a hosted one. One of the key difference in the pricing however is that the self-hosted version only includes base features.
There are many more options. Try this thread on Hackernews for example.
Overall I'm very happy with my change to Plausible. If you're at all curious about self-hosted analytics then I recommend that you give Plausible a try.
Get awesome stuff in your Inbox