Sometimes, you may need to delete some or all Visits log data for a given date, and/or a given website. For example if you have imported log files incorrectly in Matomo (Piwik) you may want to delete the invalid data that was imported.
Delete visits using the UI
As part of the GDPR Privacy features in Matomo, you can easily delete visits. Learn more in the GDPR Guide “Right to erasure”
Delete visits using a console command
A console command lets you delete all visits log data (including Visits, Actions, Goal conversions, Ecommerce activity).
To use this console command, login to your server (using SSH) and go in the Matomo (Piwik) directory. Execute the following command to display the help:
./console help core:delete-logs-data
The following options are available:
--dateslets you delete log data with a date within this date range. Eg, 2012-01-01,2013-01-01
--idsitelets you delete log data belonging to the site with this ID. Comma separated list of website id. Eg, 1, 2, 3, etc. By default log data from all sites is purged.
--limitlets you pick the number of rows to delete at a time. The larger the number, the more time is spent deleting logs, and the less progress will be printed to the screen. (default: 1000)
For example to delete all log data for month of January 2015 on website ID 42, execute:
./console core:delete-logs-data --dates=2015-01-01,2015-01-31 --idsite=42
- all the visits log data for the given date range and website ID will be permanently deleted.
- this console command does not delete your archived report data but only delete the raw visits log data.
If you want to configure Matomo (Piwik) to automatically purge your old data (whether visits log data, or statistics reports data), see this FAQ How do I delete historical Matomo data? (purge old logs and/or old processed reports)
If you want to delete old reports, read this FAQ: How do I delete all statistics for a given website, or for all websites?