Self-Hosted Analytics with Matomo

Published: March 2026

Most websites use Google Analytics to track visitors. But Google collects a lot of data—and that feels wrong for a privacy-focused site. So I installed Matomo, an open-source analytics platform that I host myself.

Why Matomo?

What I Track

Matomo shows me:

Installation

Here's how I set it up on this server:

Before you start:

# Download Matomo
cd /var/www
curl -L -o matomo.tar.gz "https://builds.matomo.org/matomo.tar.gz"
tar -xzf matomo.tar.gz

# Create database
mysql -u root -e "CREATE DATABASE matomo CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -e "CREATE USER 'matomo'@'localhost' IDENTIFIED BY 'your_password';"
mysql -u root -e "GRANT ALL PRIVILEGES ON matomo.* TO 'matomo'@'localhost';"

# Set permissions
chown -R www-data:www-data /var/www/matomo

Then configure Apache with a virtual host, get an SSL cert with certbot, and run through the Matomo web installer. That's it.

Force HTTPS

Add this to your config to force secure connections:

# In /var/www/matomo/config/config.ini.php
[General]
force_ssl = 1

Privacy First

Unlike Google Analytics, Matomo lets me own the data completely. No third parties. No creepy tracking. Just numbers that help me understand who's reading these tutorials.

If you run a website and care about privacy, consider self-hosted analytics. It's one more step toward owning your digital life.

— cjboon

← Back to Home