How to setup crontab to automatically archive the reports in Matomo

Zyxware default image3

The crontab requires php-cli or php-cgi installed. You will also need SSH access to your server in order to set it up. Let’s create a new crontab with the below commands.

vi /etc/cron.d/matomo-archive

and then add the lines:

MAILTO="[email protected]"

10 * * * * www-data /usr/bin/php /path/to/matomo/console

core:archive --url=http://testing.org/matomo/ >

/home/testuser/matomo-archive.log

The Matomo archive script will run every hour (at 10 minutes past). Usually, this takes one minute to complete, but on larger websites (10000 visitors and more) the archiving process can take up to half an hour.