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

Delete old RAW data (old tracking logs)

You can configure Matomo 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, 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 matomo_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 still partially work but only display transitions 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. Unique visitors metric will still be processed for days.

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 the UI, a console command, or even SQL queries. Read this FAQ for more information: How do I delete old visitors statistics for a given website and/or date?

Delete old reports data

If your Mysql database space is limited, you can also Delete old reports in Matomo > 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’.