# Matomo

Self-hosted analytics platform tracking all 18 managed sites.

## Location

- URL: https://stats.kaburu.co/matomo/ - Files: /home/stats.kaburu.co/public_html/ - Database: matomo (MariaDB on kaburusvr) - Version: 5.12.0 (updated 2026-08-04)

## Config file

`/home/stats.kaburu.co/public_html/config/config.ini.php`

Key settings: - DB host: 127.0.0.1, user: matomo, dbname: matomo - tables_prefix: matomo_ - schema: Mariadb (set 2026-05-11 — required for MariaDB) - trusted_hosts: stats.kaburu.co - SMTP: smtp-relay.brevo.com:587 via brevo

## Tracking

All sites use tracking URL: `stats.kaburu.co/matomo/` The /matomo/ path is a symlink: /home/stats.kaburu.co/public_html/matomo → /home/stats.kaburu.co/public_html/

Tracking code delivery: Complianz GDPR plugin handles Matomo tracking code injection on all sites. Configuration is stored in the `complianz_options_wizard` option with these key fields: - `compile_statistics` = `matomo` - `configuration_by_complianz` = `yes` - `matomo_url` = `https://stats.kaburu.co/matomo` - `matomo_site_id` = (per site, matches Matomo site ID) - `matomo_anonymized` = `yes`

Fixed 2026-06-30: 4 sites were missing tracking codes: - `dm-ph.com` (site ID 7) — Complianz installed+configured, cookie-law-info deactivated (conflict), tracking ✅ - `ggsgenerators.co.uk` (site ID 10) — Complianz installed+configured, cookie-law-info deactivated (conflict), FastPixel cache purged, tracking ✅ - `jafricasafari.com` (site ID 12) — Complianz installed+configured, FastPixel cache purged, tracking ✅ - `pro-equine.com` (site ID 16/17) — NOT on Hetzner. Hosted elsewhere, needs manual Complianz install.

## Cron archive

``` 5 * * * * root /usr/local/lsws/lsphp83/bin/php /home/stats.kaburu.co/public_html/console core:archive –url=https://stats.kaburu.co/matomo/ > /tmp/matomo-archive.log 2>&1 ```

Fixed 2026-06-30: Original cron used `www-data` user which doesn't exist on Hetzner. Changed to `root`. Archive was not running for months — raw data (266K visits) existed in log tables but was never processed into reports. Manual `–force-idsites=all` archive run triggered to process backlog.

Log: /tmp/matomo-archive.log Browser archiving is DISABLED in Matomo settings (confirmed working).

## Security (LiteSpeed vhost blocks)

config/, tmp/, lang/ directories blocked via /usr/local/lsws/conf/vhosts/stats.kaburu.co/vhost.conf Returns 403 on direct access.

## API access

Token: 57aa0e3f68a4c1f68683a8be1a20952f (stored in Matomo settings) POST requests only — token must be sent as POST parameter. From kaburusvr: `curl -s -X POST “https://stats.kaburu.co/matomo/index.php” -d “module=API&method=…&token_auth=TOKEN”`

## Known quirks

- Migrated from Chemicloud 2026-05-11 — initial dump missing core tables and log tables - IP2Location plugin bug (5.10.0): undefined $isp property — fixed with null coalescing operator - matomo_option table must exist or site shows installer error - DB schema must be set to Mariadb in config.ini.php - DBIP-City.mmdb perms (2026-08-04): GeoIP2 auto-update / Matomo upgrade downloads misc/DBIP-City.mmdb as root:root 640 → PHP (stats6482) can't read it → login shows “does not exist or is not readable”. Fix: `chown stats6482:stats6482 misc/DBIP-City.mmdb && chmod 640`. Re-check after every Matomo/GeoIP2 update.

## MainWP integration

Matomo data available via MainWP piwik tables (wpfm_mainwp_piwik) on kaburusvr.