Matomo (Piwik) tracks visitors activity, and then computes aggregated reports. The settings page lets you
- 1) Delete the Tracking Logs and / or….
- 2) Delete the old processed stats reports
1) Delete old Tracking Logs
You can configure Matomo (Piwik) to automatically delete your older tracking logs from the database. Deleting old logs has many advantages: 1) it will free significant database space, 2) which will slightly increase performance, 3) for Privacy reasons, it is sometimes recommended to keep detailed logs only for 6 months or so, and remove older data.
To configure Log delete in Matomo (Piwik), login as the Super User, click on Administration > Privacy > Anonymize Data > Delete old visitor logs. You can then configure to Delete logs older than N days, and execute the log purging every day, every week or every month. When ‘Delete old logs’ is enabled, only the raw logs of activity will be deleted from the database. Specifically, only the Mysql tables starting with piwik_log_* are affected.
Important: When you enable automatic log deletion, you must ensure that all previous daily reports have been processed, so that no data is lost. See this FAQ for more information.
Deleted data: All deleted data is lost forever.
Transitions report: The Transitions report is processed in real time, using the logs. When deleting old log data, the report will display transitions only for the days that still have log data.
Unique visitors metrics: The Unique visitors metrics for Weeks, Months, Years will be available only for those date ranges that still have log data.
If you have properly setup the auto archiving script (see important note), you will still access all historical reports (even when logs are deleted).
You can also delete old logs data by using a console command. Read this FAQ for more information: How do I delete old visitors statistics for a given website and/or date?
2) Delete old reports data
If your Mysql database space is limited, you can also Delete old reports in Matomo (Piwik) > Administration > Privacy. You can choose to keep daily, weekly, monthly and / or yearly data. We recommend keeping monthly and yearly data as an interesting dataset.
If you enable any of the 2 features to delete old data, the Database estimate size will refresh and give you an idea how much space you would save using the feature. If you cannot wait for the next automatic tasks schedule, you can also force the purge by clicking on ‘Purge Now’.