I've set up a Piwik server for logging. I've also written a script that imports historical data via the Tracking API.
In order to set a date in the past, I am using the method call PiwikTracker->setForceVisitDateTime()
. The date is set correctly in the table piwik_log_visit
.
However, if I open the dashboard I only see the statistics for the past two days. I also ran php /var/piwik/misc/cron/archive.php url=http://my.logging.url --force-all-websites --force-all-periods=2678400
(2678400 seconds = 31 Days), but to no avail.
Please note that because of my specific use case I cannot use the log importer.
My question is: How can I force piwik to (re-)generate the complete statistics for the past month?
I think I found the solution: I dropped the tables piwik_archive_numeric_YYYY_MM
and piwik_archive_blob_YYYY_MM
(where YYYY_MM is the corresponding year/month). After that, the data seems to be regenerated upon the first call.
In the Piwik FAQ Entry "How do I delete all statistics for a given website, or for all websites?" it is stated that "They will automatically be re-created from the Visitor logs when Piwik processes your reports.". However as I am using this for an importer script, I am not sure how this will affect other/existing data - So use at your own risk!