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?
- Full ownership of your data
- GDPR compliant (no consent banner needed)
- No data leaves your server
- Open source and free
What I Track
Matomo shows me:
- Total visitors and page views
- Which pages are most popular
- Where visitors come from (referrers)
- Time on site
- Devices and browsers used
Installation
Here's how I set it up on this server:
Before you start:
- Create a DNS A record for your subdomain (e.g., matomo.yourdomain.com) pointing to your server
- Wait for DNS to propagate (can take a few minutes to 24 hours)
- Disable adblocker/uBlock during the Matomo setup wizard—they sometimes block the installer
# 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