In some rare occasions it may be useful to force Matomo (Piwik) to re-process the reports from the original logs. By default, reports will only be processed once (preferably with an automatic cronjob setup to run every hour) and then archived in the database. When you visit the Matomo UI for a previous day (or week, month, etc), all you see is pre-processed data read directly from these archive tables.

Warning: to reprocess reports for specific dates, you need access to the historical visitor Log Data. Make sure you are not using the feature ‘Delete old logs‘ on your Matomo server. If you have deleted some of your old logs, Do Not Proceed! Some of your data could be lost forever.

1) Invalidate the existing historical aggregate reports

To force Matomo to re-process your reports you can use one of the following solutions:

  • (Recommended) Invalidate historical reports by calling a Console command, or using the API, or using a user interface, to tell Matomo to invalidate and re-process the past reports.

  • (Not recommended) or you could edit your config/config.ini.php file, and set (when you are done, do not forget to set these values back to 0):

    always_archive_data_day=1 ; force archiving of all daily reports
    always_archive_data_period=1 ; force archiving for all period reports (week, month, year)
  • (Not recommended) or to reprocess reports for a specific day, or specific period, you can delete the two Mysql tables matomo_archive_* for the specific month containing the dates to re-process. To delete the tables, you can use a tool such as phpMyAdmin which is usually provided by your web host.
  • (Not recommended) or to reprocess archiving for all reports for all dates, you will have to delete all matomo_archive_* tables in the Matomo Mysql Database. To delete report data for one full year including monthly reports, you may have to delete up to 24 tables (12 months * 2 tables).

You are almost done!

2) Re-process your reports

When you login your Matomo, Matomo will re-trigger the processing of the report data which will re-create the archive tables. This may take one second on a small website but it could take several minutes for bigger websites.

When you want to ensure that reports load fast, run the following command to pre-process your report data for all websites:

./console core:archive --force-all-websites --force-all-periods=315576000 --force-date-last-n=1000 --url=YOUR_MATOMO_URL_HERE

(this command is a little customisation of the standard core:archive cron command. To learn more about what the parameters mean, run ./console help core:archive)

Conclusion: you have re-processed your data and it should now appear as expected in your dashboard.