<!--
  canonical-url: https://www.avonture.be/blog/matomo-install
  published:     2024-01-28
  This is a static plain-Markdown mirror generated at build time.
  Visit the canonical URL above for the fully rendered page, with images and interactive components.
-->

# How to self-host Matomo

> Self-host Matomo for free and gain GDPR-compliant website analytics. This simple guide covers installation, database setup, and Docusaurus integration.

---
![How to self-host Matomo](/img/v2/matomo.webp)

**TL;DR**

This article walks through self-hosting Matomo, a GDPR-compliant web analytics tool, on a subdomain: downloading and unzipping the release over SSH, creating a MySQL database, running the installation wizard, and finally wiring up the tracking script — including the `docusaurus-plugin-matomo` plugin for Docusaurus sites.

[Matomo](https://matomo.org) is a GDPR-compliant tracking tool for your website. I've finally decided to install it so that I can get the blog's traffic figures; find out which articles are the most widely read, which topics are of most interest, etc., not just out of curiosity but also to get a better idea of the audience.

I've chosen the [self-hosted solution](/blog/docker-memos) (because it's free) so that my traffic figures remain on my own server.

The installation is a piece of cake: download a zip file, unzip and start the wizard. Really easy.

There is a nice tutorial on <https://matomo.org/faq/on-premise/installing-matomo/>.

On my side, here are the actions I took:

1. Create a subdomain `matomo.avonture.be` pointing to a specific folder on my host.

2. Create an SSL certificate for the sub-domain.

3. Connect to that new folder using SSH

   * Run `wget https://builds.matomo.org/matomo.zip` to download the latest version

   * Run `unzip -o matomo.zip` to unzip and get files

   * Run `rm -f matomo.zip "How to install Matomo"` to remove two unneeded files

Since I know I should have a MySQL database, I went to my dashboard. For [PlanetHoster](/blog/planethoster-n0c-spam), it's <https://my.planethoster.com> and there, I created a new MySQL db and its user.

Finally, I just need to start the wizard on `https://matomo.avonture.be/index.php` and follow the guide.

The wizard is really well done and very easy to follow.

When done, I get my dashboard on <https://matomo.avonture.be/index.php> and I just need to add my tracking script to my pages as explained in the wizard.

## Docusaurus

On [this blog](/blog/docusaurus-docker-own-blog), I'm using [Docusaurus](https://docusaurus.io/) so I've installed a plugin for this: <https://github.com/karser/docusaurus-plugin-matomo>.
