Cleanup Database and Remove ExactMetrics WordPress Plugin

Sometimes plugins get purchased and totally revamped. This can go well and make your user base very happy but it can also have the opposite effect. For ExactMetrics the re-branding went terribly and users became irate leaving enough 1 star reviews to completely tank the plugin’s previously stellar, almost perfect 5 star rating.

I was a huge fan of this plugin but now it has to be replaced. After removing plugins you never want to use on your WordPress site again you should clean up the database.

If you need help cleaning up your database feel free to get in touch here or if you are brave enough to try on your own try this plugin.

The ExactMetrics plugin has the original plugin name’s slug google-analytics-dashboard-for-wp just so that is clear.

Clean up Database and Remove ExactMetrics WordPress Plugin

When scanning the database I noticed a lot of these values which look like they are from before the re-brand

gadwp_cache_qr2_3605441529

I am using WP-CLI to clean these but you can copy the query and execute it in phpMyAdmin or Adminer (just relpace the $(wp db prefix --allow-root) with your actual options table name which by default is wp_options).

wp db query "DELETE FROM $(wp db prefix --allow-root)options WHERE option_name LIKE 'gadwp\_%'" --allow-root

Delete the rest of the ExactMetrics options that don’t contain the string ExactMetrics

wp option delete widget_gadwp-frontwidget-report --allow-root
wp option delete _amn_exact-metrics_to_check --allow-root
wp option delete _amn_exact-metrics_last_checked --allow-root
wp option delete gadwp_cache_sampleddata --allow-root
wp option delete widget_gadwp-frontwidget-report --allow-root

There are more wp_options rows starting with exactmetrics prefix

wp option delete exactmetrics_tracking_notice --allow-root
wp option delete exactmetrics_usage_tracking_config --allow-root
wp option delete exactmetrics_site_profile --allow-root
wp option delete exactmetrics_over_time --allow-root
wp option delete exactmetrics_db_version --allow-root
wp option delete exactmetrics_current_version --allow-root
wp option delete exactmetrics_settings --allow-root
wp option delete exactmetrics_review --allow-root

You can also do the database query in phpMyAdmin or Adminer to clean those Exactmetrics values, here is the WP-CLI version

wp db query "DELETE FROM $(wp db prefix --allow-root)options WHERE option_name LIKE 'exactmetrics\_%'" --allow-root

I find a post_type named amn_exact-metrics too

wp post list --post_type=amn_exact-metrics --post_status=draft,revision,publish --allow-root

You can delete these ExactMetrics leftover database records in the posts table like this

wp post delete $(wp post list --post_type=amn_exact-metrics --post_status=draft,revision,publish --format=ids --allow-root) --allow-root --force

Now we can deactivate and delete the ExactMetrics plugin with WP-CLI – you must use --force or you will see this error ‘Warning: Posts of type ‘amn_exact-metrics’ do not support being sent to trash.’

wp plugin deactivate google-analytics-dashboard-for-wp --allow-root
wp plugin delete google-analytics-dashboard-for-wp --allow-root

Now let’s delete the cron job from ExactMetrics

wp cron event delete exactmetrics_usage_tracking_cron --allow-root

You should get this output

Success: Deleted the cron event 'exactmetrics_usage_tracking_cron'.

The whole WP-CLI script to clean up the database options leftover by ExactMetrics is then as follows

wp db query "DELETE FROM $(wp db prefix --allow-root)options WHERE option_name LIKE 'gadwp\_%'" --allow-root
wp option delete _amn_exact-metrics_to_check --allow-root
wp option delete _amn_exact-metrics_last_checked --allow-root
wp option delete widget_gadwp-frontwidget-report --allow-root
wp option delete gadwp_cache_sampleddata --allow-root
wp option delete exactmetrics_tracking_notice --allow-root
wp option delete exactmetrics_usage_tracking_config --allow-root
wp option delete exactmetrics_site_profile --allow-root
wp option delete exactmetrics_over_time --allow-root
wp option delete exactmetrics_db_version --allow-root
wp option delete exactmetrics_current_version --allow-root
wp option delete exactmetrics_settings --allow-root
wp option delete exactmetrics_review --allow-root
wp plugin deactivate google-analytics-dashboard-for-wp --allow-root
wp plugin delete google-analytics-dashboard-for-wp --allow-root
wp cron event delete exactmetrics_usage_tracking_cron --allow-root

Install this plugin instead GAinWP Google Analytics Integration for WordPress which has the same beautiful dashboard widget you probably loved from GADWP.

You can install it with WP-CLI like this, the setup is very easy!

wp plugin install ga-in --activate

If I missed any please do leave a comment with the details and I will update the post as soon as I can 🙂

1 thought on “Cleanup Database and Remove ExactMetrics WordPress Plugin”

  1. Is there a plugin that would clean the database? I am not familiar with the database workings and dont want to mess it up.

Comments are closed.