Configure Data Retention
The amount of time you hold onto your analytics data for is known as the data retention period. For the discussion of data retention within Matomo, there are essentially two types of data:
-
Raw Data: This shows you all of the information about a single visit to a website and is typically accessed through the visit log. It includes the source, available user data, and all on-site activity within a visit. This information is also used when creating new segment reports.
-
Report Data: This is the aggregated data that is compiled from the raw data to create reports which show information about groups of users for a specific metric. An example would be the number of visits from a certain country on a specific date. This is the most commonly used type of data for reviewing your website trends over time.
Matomo enables you to set different data retention policies for each type of data to enhance the privacy of your users. If you are using Matomo Cloud then you can keep an unlimited amount of report data, but the amount of raw data you can keep is limited in accordance with your plan. However, if you are using the Matomo On-Premise or Matomo for WordPress version then you can choose to keep both types of data indefinitely.
As a general guideline you should:
- Store information only for as long as you actually need and use it.
- Share details of your retention policy in your privacy policy.
Automatically Delete Old Raw Data
As raw data is inherently more personal and can be used to identify the actions of a single user, it is common to delete this type of data more frequently than aggregate report data. In some jurisdictions, there is a legal requirement to limit the retention of personal data for no longer than necessary. While there is not a universally recommended time-frame, if you are unsure, the 24-month maximum offered by the Matomo Cloud Business plan is likely a good starting point.
- Click Anonymize data within the Privacy menu on the Matomo Settings page.
- Scroll down to the Regularly delete old raw data section.
- Click Regularly delete old raw data from the database so a green tick is shown.
- Enter a number of days into the Delete logs older than (days) text field. For reference: one year is equal to 365 days and two years is equal to 730 days.
- Click the big green Save button.
Automatically Delete Old Aggregated Report Data
Report data is core to the Matomo experience and as such it is possible to keep reports indefinitely. The main reason to remove aggregated data is if you no longer need access, or if the data is taking up space on your server. For this reason, Matomo offers several options about exactly which types of reports are deleted from your server on a regular basis.
- Click Anonymize data within the Privacy menu on the Matomo Settings page.
- Scroll down to the Delete old aggregated report data section.
- Click Regularly delete old reports from the database so a green tick is shown.
- Enter a number of days into the Delete logs older than (months) text field.
- It is generally best to check the box to Keep basic metrics unless you have a reason not to. This feature retains data that cannot be associated with personal data i.e. numeric metrics without labels attached.
- Select the reports you would like to Keep all data for.
- Click the big green Save button and the remaining data will be deleted regularly.