Clear out data for a specific day

I am trying to clear out the stats for a specific day and I think I’m missing something. Currently I’m issuing two sql statements:


DELETE FROM piwikstats.piwik_log_visit WHERE idsite = 2 AND (visit_first_action_time >= '2012-07-31 00:00:00' AND visit_first_action_time <= '2012-07-31 23:59:59') AND (visit_last_action_time >= '2012-07-31 00:00:00' AND visit_last_action_time <= '2012-07-31 23:59:59');

and


DELETE FROM piwikstats.piwik_log_link_visit_action WHERE idsite = 2 AND server_time >= '2012-07-31 00:00:00' AND server_time <= '2012-07-31 23:59:59';

and then I issue the command to invalidate the existing reports. This seems to get rid of most data for the day, but I’m still seeing about 69 visits and about 4k page views. I looked in the other tables but I’m not seeing anything…

Is there a reliable way to remove all information for a full day? I’m going to reimport my log files, but I want to have a clean slate for that day so I can make sure I’m not doubling my stats (which is currently happening).

Thanks!

Are your website setup in Timezone UTC?

Because piwik dates in the DB are in UTC. So if your website uses different timezone change the dates so they match the actual day.

Good call. I’ll make sure to modify the code to delete the data in that way.