• Resolved tomdkat

    (@tomdkat)


    Hi! So, I used WP Statistics on a fairly busy site a couple of years ago and switched to another statistics tool because WP Statistics wasn’t working for me. I used that other tool up until about a couple of weeks ago, when IT started behaving differently and I went back to WP Statistics.

    When I loaded WP Statistics again, I noticed in the Traffic Overview panel that shows today’s traffic, yesterday’s traffic and the total visits, etc, that it should over 200k total visits, which can’t be right since I had WP Statistics installed for only a day or so and the site will get hundreds of visits a day, nowhere near 100k a day. So, I looked at the settings and enabled the “delete all data when plugin is deleted” option, saved the change and deleted WP Statistics. I re-installed it and the total visits went to 0 BUT the “Yesterday” number wasn’t 0, which is weird since I had just deleted the plugin. lol

    So, when WP Statistics is deleted and it’s setup to delete ALL data, something got missed. Is some traffic data is uses for reporting not stored in the database or something?

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mostafa Soufi

    (@mostafas1990)

    Hi @tomdkat,

    Thanks for the careful write-up. Short answer first, then the details and a couple of things to verify on your end.

    All WP Statistics traffic data lives in the database, not in files. When the “Delete all data when plugin is deleted” option is enabled and you fully delete the plugin from the Plugins screen (the red Delete link, not just Deactivate), the uninstaller does all of the following:

    – Deletes the wp_statistics_* rows from the options table.
    – Deletes every usermeta / postmeta key starting with wp_statistics.
    – Clears the scheduled cron hooks.
    – Drops every plugin table, including visitor, exclusions, pages, historical, visitor_relationships, summary_totals, and the add-on tables (events, campaigns, goals, ar_outbox).

    Now, about the specific behavior you saw:

    **”Total” going to 0** after the delete and reinstall is the expected result. The tables were dropped and recreated empty, so there is no historical data to total up.

    **”Yesterday” being non-zero** is almost certainly not leftover data. The Yesterday bucket is calculated as the previous calendar day, not as “everything before the reinstall”. So if you reinstalled the plugin at some point before midnight of yesterday, any real visits the tracker captured between reinstall time and 23:59 yesterday land in that bucket as soon as the date rolls over. It is real new traffic, just bucketed under yesterday.

    Two things would help confirm this and rule out a stale state:

    1. Could you check, via phpMyAdmin or any DB tool, whether these still have any rows after your delete + reinstall:

    `
    SELECT option_name FROM wp_options
    WHERE option_name LIKE ‘wp_statistics%’;

    SHOW TABLES LIKE ‘%statistics_%’;
    `

    If the only tables you see are the freshly recreated ones and they are mostly empty (a small number of rows in visitor / pages / summary_totals matching the time since the reinstall), that lines up with the explanation above.

    2. Are you running a caching plugin (WP Rocket, W3 Total Cache, LiteSpeed, etc.) or an object cache (Redis, Memcached)? Cached dashboard widgets can keep showing old numbers for a while after a reinstall. Flushing the site cache and reloading the dashboard is worth a try.

    One more thing worth knowing: you do not have to uninstall the plugin to wipe the data. WP Statistics has a built-in cleanup tool at **WP Statistics > Optimization > Purging**, which lets you purge data and visitors without removing the plugin.

    If the SQL check above shows leftover rows or tables we did not expect, please paste the result back here and I will trace it.

    Best regards,

    Thread Starter tomdkat

    (@tomdkat)

    Hi! Thanks for the great response!!!! So, if I use the “Purging” section to purge the data, should I expect all of the counts to reset to 0? I do use a caching plugin (WP Fastest Cache) but I believe I emptied the cache after removing the plugin, such that when I re-installed it, it would install correctly (not having cached data interfering).

    Thanks!

    Thread Starter tomdkat

    (@tomdkat)

    Ok, I’m logged into my dashboard now. When I go to ‘Statistics’ > ‘Optimization’ I don’t see “Purging” but I see:

    Overview & Info
    Data Export
    Data Cleanup
    Plugin Maintenance
    Historical Data

    I can see the overview info fine and it shows the amount of PHP memory being used, etc. When I click the other items, nothing happens. Are those premium features? If so, I’ll try the table deletion again and I’ll verify everything got deleted as expected.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.