Piwik is designed to be run in any environment, which means no matter how much database space you have available, Piwik will work for you. In fact, Piwik grants you the power to choose exactly what data to keep, and what data to delete.

This functionality is available on the Privacy admin page in the Delete old visitor logs and reports section.

Here you can pick whether you want to keep or delete visitor logs (the data that is recorded each time a visitor action is tracked) and whether you want to keep or delete processed reports (the data that is created when your visitor logs are analyzed). By default, nothing is purged.

Additionally, you can also see how much space your database is taking up and get an estimate for how large your database will be after the next purge:

Using these tools, you can keep your Piwik database at a manageable size, regardless of your space limitations.

NOTE: Though Piwik allows you to delete your data, we strongly recommend that if you have no space constraints, you keep all your data.

Deleting old unprocessed data

When Piwik tracks a visit, action, conversion or something else, data describing this action is stored in the database. This data is raw visit information and does not show you any trends or analytical information. It is processed later during the archiving process which creates the analytical information (referred to as report data).

After this data is analyzed, it is no longer needed, so it can be a good idea to delete it if you have limited database space.

To set this up, first select Yes in the Regularly delete old visitor logs from the database row. Then experiment with how old you want the purged log data to be. Everytime you modify the value, a new database size estimate is calculated, so you figure out exactly how much data you need to delete.

When done, click Save and then Yes after reading the prompt.

WARNING

Although this data is not necessary after your reports are processed, it is still needed if you want to use the Visitor Log to view old visits or if you want to reprocess your reports. There are a couple reasons you may want to do this, including:

  • There was a bug in Piwik that affected some reports and you’d like to see old reports that are not affected by it.
  • There are new reports in a new version of Piwik, and you want to see them for old data.
  • You want to apply geolocation to old visits.

Deleting old reports

When Piwik analyzes your tracked data, it stores the result of this analysis in the database so the analyisis does not have to be run every time you view a report. This stored data are referred to as reports.

If for some reason you do not have to or want to analyze old visit data, or if you don’t normally look at this old data, you can delete it to save database space.

To set this up, first select Yes in the Regularly delete old reports from the database row. Then decide which reports/metrics you don’t want and which you do.

You have the choice of deleting all your reports & metrics, or just some. Everytime you make a change to these options, a new database size estimate is calculated so you can see how much space you will save.

When done, click Save and then Yes after reading the prompt.

If later you want to see the reports you deleted, you can reprocess your reports.

WARNING

Deleting your old reports means you won’t be able to see long term trends.

Additionally, if you also delete old log data, you will not be able to reprocess your reports, meaning report data will be permanently lost! Please think carefully before deleting both unprocessed data and reports.

Manually triggering a data purge

Data purging is done on a regular basis. You can decide how long to wait between purges on the screen:

You may find, however, that you need to execute a purge right away. If you want to do this, there is a link you can click:

Clicking it will start a purge. When the purge is complete a new database size estimate will be displayed.

Note: Purging data can take a LONG time.

You now know everything you need to know to keep your database size manageable!