Elixir in Production: Plausible Analytics

Searching for an open-source Google Analytics alternative?

Our guest has your back. Uku Täht is the founder of Plausible Analytics, an open-source web analytics project built with Elixir. For the last couple of months, his project has attracted a lot of attention through informative blog posts and very positive user reviews.

In this interview, we talk about his use of Elixir in production: the benefits, the downsides, the specifics, and why Elixir is so good for projects like Plausible Analytics.

Interview with Uku Täht

Could you tell us a little about your company and your role there?

Plausible Analytics is an open-source project dedicated to making web analytics more privacy-friendly. Our mission is to reduce corporate surveillance by providing an alternative web analytics tool that doesn’t have any links to AdTech.

I started building Plausible almost two years ago as a side project. I’ve been working on it full-time since the beginning of this year and I’ve also partnered up with Marko who handles the marketing and communication side of things.

The founder of Plausible Analitics, an alternative to GA

Uku Täht, the founder of Plausible Analytics.

What is the key feature or set of features that make using Plausible Analytics a feasible replacement over Google Analytics?

Google Analytics is overkill for most website owners. Plausible cuts through the noise by presenting all the important website traffic insights and metrics on one single page. You don’t need training or experience in web analytics to get started.

Keeping the script lightweight is also a priority. Our script is more than 17 times smaller than the Google Analytics script and more than 45 times smaller than the recommended Google Analytics integration using the Google Tag Manager.

But the biggest reason to choose Plausible is the fact that we’re committed to building open source software. The code behind our service is freely available for anyone. By using Plausible you help build software that everyone can benefit from, not just the corporations.

How did Elixir as the language of choice work for you when implementing these features?

I think Elixir is perfect for our use-case. It’s a very productive language once you learn it and it can also handle tons of traffic. Last month we processed 60 million pageviews with absolutely no issues.

Elixir really shines when you have stateful requirements for the app server. For example, we keep all the active sessions in memory so we don’t have to look a session up from the database on every event. It was a joy to build this part of the app using the GenServer primitives.

How much did the fact that your product is not only self-hosted but also a SaaS inform your decision to go with Elixir? Did you choose it to scale a SaaS?

I do believe that using Elixir allows us to make self-hosting a bit easier. In other languages, it’s common to use tools like Redis and external message queues but in Elixir we can often avoid these extra tools and keep the infrastructure requirements simple.

Plausible is currently designed to run on just one node. Once we start building out support for multi-node deployments, things will get really interesting. I feel like Elixir and the BEAM are designed perfectly for our use-case where we need multiple nodes to share state about visitors sessions.

Hopefully, we can evolve the architecture without needing extra infrastructure bits and pieces. The goal is to keep the requirements as simple as possible so everyone can run the code on their own server. By relying on BEAM fundamentals, we can probably avoid in-memoy stores, external message queues, and cluster managers altogether, making Plausible easy to self-host.

Could you tell us more about your deployment: where do you host, how do you deploy, do you use the hot code reload functionality?

We recently moved from Heroku to using Digital Ocean. I wanted to eat our own dog food when it comes to the Docker infrastructure we built for self-hosting. So now we have a Digital Ocean droplet pre-configured with Docker and we just pull new images from our DockerHub.

Since we have a single node deployment, we do have around 30 seconds of downtime on each deploy and we don’t have auto-scaling support. We will deal with these issues as we scale, I just wanted to be upfront about the downsides of how we’re running it.

We don’t use hot code reloading since it doesn’t play well with the Docker flow.

What was the biggest challenge while developing Plausible Analytics with Elixir?

We use a database called Clickhouse for storing our stats. It’s a fairly new and cutting-edge database and it doesn’t have a robust integration with Elixir yet. We use a low-level connection library which gives us random errors sometimes.

I’m thinking about taking the time to write a proper Ecto adapter for Clickhouse so we can run migrations and have better error handling. It’s easy to complain about the lack of libraries in the Elixir ecosystem but I’d like to do my part in helping the ecosystem thrive.

Are you satisfied with the result?

Definitely. If I could go back and do it all over, I would choose the same stack again. Elixir+Phoenix is really fun to work with and it performs even better than I expected.

Any key takeaways that you would like to share with our audience?

Elixir is a wonderful language and its ecosystem is really coming along. I would encourage everyone to give it a try and contribute back to the ever-growing list of libraries and frameworks to make it even more powerful.


I’d like to thank Uku for the interview! If you want to see more examples of Elixir used in production, check out our interview with one of the Venu co-founders or read our post about companies that use Elixir.

Additionally, if you have your own Elixir in production story to tell (both good and bad), we definitely want to hear it! You are welcome to write to us: hi@serokell.io.

Do you need Elixir consulting? Serokell is your reliable partner in building web applications, messaging and VoIP applications, blockchain solutions, and more. Contact us to find out how we can help you!

Elixir in Production: Plausible Analytics
Banner that links to Serokell Shop. You can buy awesome FP T-shirts there!
More from Serokell
elixir in production thumbnailelixir in production thumbnail
8 Companies That Use Elixir to Win8 Companies That Use Elixir to Win
Elixir for beginners thumbnailElixir for beginners thumbnail