Auto archive in Matomo

As I’ve discovered, setting up auto archival of Matomo reports makes Matomo faster (and also helps automate downloading of the geolocation databases). Generally speaking, follow the official auto-archiving guide .. BUT the cron job instructions don’t put things in the “correct” cron.hourly folder, and my OCD needed to fix that. 😉

Create the following file: /etc/cron.hourly/matomo-archive

#!/bin/sh
# Script to automate Matomo report archival

/usr/bin/php /path/to/matomo/console core:archive --url=https://matomo.example.com/ > /var/log/matomo-archive.log

Update the bits in yellow to whatever is appropriate for you. Run the cron job manually – it may take quite some time! Afterwards, make sure you’ve disabled browser triggers for Matomo auto archival (per the official guide).