In some rare occasions it may be useful to force 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 Piwik 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 Piwik server. If you have deleted some of your old logs, Do Not Proceed! Some of your data could be lost forever.

1) Cleanup the existing archived data

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

  • (Recommended) To reprocess reports for a specific day, or specific period, you can delete the two Mysql tables piwik_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.
  • or if you wish to reprocess archiving for all reports for all dates, you will have to delete all piwik_archive_* tables in the Piwik 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).
  • or you can also call the API to tell Piwik that old data was imported
  • or you can edit your config/config.ini.php file, and set (when you are done, do not forget to set these values back to 0):

    [Debug]
    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)
    

You are almost done!

2) Re-process your reports

When you login your Piwik, Piwik 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_PIWIK_URL_HERE

(this command is a little customisation of the standard core:archive cron command.)

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