Improving Matomo’s performance
Using Matomo to measure the audience of your website is a good decision. As well as being Open Source and free, it gives you visitor statistics for the whole volume of visitors. Moreover, it is GDPR friendly.
However, if you deploy Matomo as part of a self-hosting solution, you will have to deal with the volume of data storage. And it then becomes important to optimise and aggregate the data in order to improve the performance of the reports.
As part of my work at the regional tourism agency AURAT, I manage a cloud server at Infomaniak. This is where we set up a Matomo instance.
Setting up the Crontab
You will have to access the SSH console with the Web SSH Tool. Go to the manager of your Infomaniak hosting.

You will be managing the current user’s crontab, so it is not necessary to specify the user in the command parameters.
crontab -e
If the crontab associated to the user does not exist, it is created automatically and you are then asked to choose the editor. I advise you to stick with nano, as it will be easier to copy and paste.
Select an editor. To change later, run ‘select-editor’.
Select an editor. To change later, run 'select-editor'. 1. /bin/nano <---- easiest 2. /usr/bin/jmacs 3. /usr/bin/joe 4. /usr/bin/jpico 5. /usr/bin/jstar 6. /usr/bin/rjoe 7. /usr/bin/vim.basic 8. /usr/bin/vim.tiny Choose 1-8 [1]: 1 crontab: installing new crontab
Here is the instruction to add to archive every day at 4am:
0 4 * * * /usr/bin/php /path/to/matomo/console core:archive --url=http://example.org/matomo/ > /home/example/`date +\%Y-\%m-\%d_\%H-\%M-\%S`-matomo-archive.log
Main parameters
- /usr/bin/php : is the path to your PHP executable. It varies depending on your server configuration and operating system.
- /path/to/matomo/console : is the path to your Matomo app on your server.
- http://example.org/matomo/ : is the only required parameter in the script, which must be set to your Matomo base URL.
- /home/example/`
date +\%Y-\%m-\%d_\%H-\%M-\%S`-matomo-archive.log : is the path where the script will write the output. You can replace this path with /dev/null if you prefer not to log the last Matomo cron output text.
To test whether the Crontab and the archiving command are working, you can change the time configuration using this online tool. Then check that the log file has been created in the folder you specified.
Source for this article : https://matomo.org/faq/on-premise/how-to-set-up-auto-archiving-of-your-reports/