Documentation Optimization Settings Optimization: Data Cleanup

Optimization: Data Cleanup

Data cleanup is a crucial aspect of maintaining the performance and efficiency of your WordPress website. The WP Statistics plugin offers a comprehensive set of tools designed to help you manage and optimize your database by cleaning up unnecessary data. Below, we describe each option available on the Data Cleanup settings page, along with use cases to illustrate their practical applications.


Clear Table Contents

This function allows you to completely clear the content of selected database tables that are part of WP Statistics. It’s a drastic action that should be used with caution as it will permanently delete all data in the table.

Use Case:

If you are decommissioning your website or re-purposing it and you need to ensure that all previous analytical data is removed, you can use this option to start fresh.

Delete Records Older Than

Automatically purges records that are older than a specified number of days. This helps in maintaining a lean database by removing outdated data.

Use Case:

For a website that has been running for several years, old data may no longer be relevant for current analytics. Setting this to delete records older than 365 days would keep the database size in check and the performance optimal.

Remove Visitors Exceeding

This feature targets bot-related data by removing visitor statistics that exceed a certain number of daily views, which can be indicative of non-human traffic.

Use Case:

If your website has been targeted by bots resulting in skewed statistics, you can set a threshold (e.g., 10 views) to remove these anomalies and keep your data focused on real user interactions.

Remove User IDs

This option allows you to permanently delete all stored user IDs from your database. This feature is particularly useful for anonymizing your user visit records or complying with privacy regulations.

Use Case:

In the event that your website needs to adhere to strict privacy laws such as GDPR, where user identification needs to be anonymized, the ‘Remove User IDs’ function can be used to delete all identifiable information linked to user IDs. This ensures privacy compliance and the protection of user data.

Related Guide: Removing User IDs from Your Database

Clear User Agent Strings

By selecting this, you can permanently remove all User Agent Strings from your database. User Agent Strings contain details about the browser, operating system, and device used by a visitor to access your website. This option should be used once troubleshooting related to these strings is completed to ensure that unnecessary data is not stored.

Use Case:

If you have resolved issues related to how different browsers interact with your website and no longer need the historical data for analysis, you can clear the user agent strings. This can help in reducing the database size and protecting user privacy by removing potentially identifiable information.

Related Guide: How to Clear User Agent Strings

Clean Up Recorded Query Parameters (version 14.5 and above)

The “Clean Up Recorded Query Parameters” option allows you to remove previously stored query parameters from your historical data based on “Allowed Query Parameters“. This ensures that your recorded data remains consistent with your current privacy settings and analytics configurations.

By using this feature, you can:

  • Enhance Privacy: Align historical data with current data capture policies.
  • Improve Data Relevance: Remove outdated or irrelevant query parameters that no longer serve your analysis needs.
  • Maintain Consistency: Ensure that changes to allowed query parameters are reflected not just moving forward, but also retroactively.


It is recommended to back up your database before proceeding, as this cleanup is irreversible. Once the data has been purged of the specified query parameters, it cannot be restored. Make sure to take the necessary precautions to safeguard your data before initiating the cleanup process.

For detailed instructions on how to safely perform this cleanup and for information on how it may affect your reporting, please visit our comprehensive guide here.

Remove Certain User Agent Types

Choose Agents to Delete

Allows you to delete data associated with certain user agents. User agents help in identifying the type of device or browser used to access your website.

Use Case:

You might want to exclude traffic from known bots or specific browsers that are no longer supported by your website, ensuring that your analytics only reflect the relevant audience.

Choose Operating Systems to Delete

Similar to user agents, this option enables you to remove data from certain Operating Systems, like mobile or desktop, to tailor your statistics.

Use Case:

If you’re rebranding your website to target mobile users exclusively, you might want to remove all desktop-related data to streamline your analysis.

Erase Data for Specific IP

This is a more targeted approach where you can remove all data associated with a specific IP address.

Use Case:

This can be particularly useful if you’ve identified an IP address that is skewing your statistics through fraudulent or non-representative activities.


Regular use of these data cleanup options can greatly improve your website’s performance and ensure that your statistics accurately represent your real user base. Each setting should be used with an understanding of its impact, and with the knowledge that data, once deleted, cannot be recovered. Always ensure you have a backup before performing any cleanup action.