If you find this add-on useful, please star it on GitHub — stars show appreciation and help maintainers know their work matters.
ddev-matomo provides an integration with Matomo - the leading open-source analytics platform that gives you more than powerful analytics. This add-on makes it easy to run Matomo alongside your DDEV project with proper database isolation and version flexibility.
matomo:5 tag, pin to a specific version when needed)ddev add-on get madsnorgaard/ddev-matomo
ddev restart
ddev add-on get madsnorgaard/ddev-matomo
.ddev/configure-matomo.sh later, or.ddev/docker-compose.matomo.yaml directlyddev restart
https://matomo.<projectname>.ddev.sitedbmatomo (or your custom name)dbdbmatomo_ (recommended)This add-on creates a separate database for Matomo to prevent any conflicts with your application database (Drupal, WordPress, etc.).
Default behavior:
matomoCustom database name:
If you need a different database name, create .ddev/config.matomo.yaml:
MATOMO_DATABASE_DBNAME: "analytics" # or any name you prefer
The database is automatically created during installation. If you need to recreate it:
# Create empty Matomo database
echo "CREATE DATABASE IF NOT EXISTS matomo;" | ddev mysql
# Or if using custom database name:
echo "CREATE DATABASE IF NOT EXISTS your_custom_db;" | ddev mysql
If you have an existing Matomo installation:
# Import to Matomo database (not your main database!)
ddev import-db --database=matomo --file=matomo-backup.sql
| Matomo Version | Support Status | Use Case |
|---|---|---|
| 5.x (default) | Active development | Recommended for all installations |
| 4.x | EOL since 2024-12-19 | Not supported - see Matomo’s LTS policy |
Matomo 4.x reached end of life in December 2024 and no longer receives security updates. This add-on tracks the matomo:5 Docker tag by default. Pinning to a 4.x tag still technically works but is strongly discouraged.
Option 1: Configuration Script
.ddev/configure-matomo.sh
Option 2: Manual Edit
Edit .ddev/docker-compose.matomo.yaml:
# Default - rolling latest 5.x
image: matomo:5
# Or pin to a specific release
image: matomo:5.9.0
Then restart:
ddev restart
MariaDB note: This add-on is tested against DDEV’s default databases (MariaDB 10.11 and 11.4). Avoid MariaDB 11.5.x — it has a known incompatibility with Matomo 5.1+.
All settings are configured in .ddev/docker-compose.matomo.yaml. You can edit values directly:
services:
matomo:
# Change Matomo version here
image: matomo:5
environment:
# Database settings
MATOMO_DATABASE_DBNAME: matomo
MATOMO_DATABASE_TABLES_PREFIX: matomo_
# PHP settings
PHP_MEMORY_LIMIT: 256M
PHP_MAX_EXECUTION_TIME: 300
PHP_POST_MAX_SIZE: 16M
PHP_UPLOAD_MAX_FILESIZE: 16M
# Matomo settings
MATOMO_GENERAL_ENABLE_TRUSTED_HOST_CHECK: 0
MATOMO_GENERAL_ASSUME_SECURE_PROTOCOL: 1
After editing, run ddev restart.
For tracking multiple sites in one Matomo instance:
The add-on automatically handles git integration for team development:
What gets committed:
.gitkeep files)config.matomo.yaml)What gets ignored:
Team Development:
# New team member setup - just install and restart
ddev add-on get madsnorgaard/ddev-matomo
ddev restart
# Matomo will recreate all runtime files automatically
The .ddev/.gitignore file is automatically created/updated during installation.
Problem: “Error while trying to connect to the database”
Solution: Ensure the database exists:
echo "CREATE DATABASE IF NOT EXISTS matomo;" | ddev mysql
ddev restart
Problem: Matomo says it’s already installed but you can’t access it
Solution: Clear Matomo’s config:
ddev exec -s matomo rm -f /var/www/html/config/config.ini.php
ddev restart
Problem: “File integrity check failed” with lists of directories and files to delete
Solution: This was caused by mounting plugins directory in older versions.
ddev add-on get madsnorgaard/ddev-matomo.ddev/docker-compose.matomo.yaml:
# Remove these lines if present:
# - ./matomo/plugins:/var/www/html/plugins
# - ./matomo/tmp:/var/www/html/tmp
ddev restartProblem: Matomo tables appearing in your application database
Solution:
.ddev/docker-compose.matomo.yamlmatomo (or your custom name) as the database during Matomo setupProblem: “Matomo couldn’t write to some directories”
Solution:
ddev exec -s matomo chown -R www-data:www-data /var/www/html
ddev restart
This is a community-maintained fork of the original ddev-matomo add-on. The original was created by valthebald but is no longer actively maintained.
This fork aims to:
We welcome contributions from the community! Here’s how you can help:
MIT License - See LICENSE file for details
If you find this add-on useful, please star it on GitHub — stars show appreciation and help maintainers know their work matters.