How to clean Matomo from trash data

I accidentally enabled all importer parameters. In this way, a lot of useless data has been saved to DB which increases the statistics and visits too much. Is there a way to clean up the DB leaving only the useful data?

Parameter used are: --recorders=4 --enable-http-errors --enable-http-redirects --enable-static --enable-bots

Hi @Eternity6
You can use the :gear: > Privacy > GDPR Tools tool.

Don’t forget, after the data cleaning, to invalidate past historical reports:

To clean trash data in Matomo, you need to remove unnecessary logs, old visits, and unused reports to keep analytics accurate and improve performance. Here’s a simple step-by-step guide:

1. Enable Data Retention Settings :broom:

  • Go to Administration

  • Click Privacy → Anonymize Data

  • Enable Delete old visitor logs

  • Set retention period (e.g., 90 days or 180 days)

  • Save changes

This automatically removes outdated data from your database.

2. Purge Old Reports :bar_chart:

  • Navigate to Administration → System → General Settings

  • Enable Delete old reports

  • Choose how long to keep aggregated reports

  • Save and apply

This helps remove unnecessary historical summaries.

3. Delete Bots & Spam Traffic :robot:

  • Go to Administration → Websites → Bot Filtering

  • Enable Exclude known bots

  • Add spam referrers in Referrer Spam Blacklist

  • Save changes

This prevents future junk data from being stored.

4. Clean Logs Manually (Advanced) :gear:

If you manage your server:

  • Run Matomo console command:
./console core:purge-old-archive-data

This clears archived data that is no longer needed.

5. Remove Unused Websites :wastebasket:

  • Go to Administration → Websites

  • Delete test or duplicate tracking sites

  • This removes irrelevant data sources

6. Clear Cache for Fresh Reports :high_voltage:

  • Go to Administration → System → General Settings

  • Click Invalidate Reports

  • Matomo will regenerate clean data

As suggested you can remove the raw data logs, but keep in mind you won’t be able to archive these date ranges again or create custom reports using historical data.