There are a few cases where you need to re-process some historical data directly from the raw logs.

For example a common use case is when you use the REST Tracking API to manually insert visits and actions in Piwik in the past (via the Tracking API parameter cdt which lets you define the date and time of the page view). If you set this date to a date in the past (for example, 3 days ago) and that Piwik has already processed the statistics reports for this date, you will not see the newly added data in Piwik.

Another common example is when you create Custom Reports, or Funnels, and want to see the Custom report data and Funnel data for past dates as well.

To tell Piwik to invalidate historical aggregated data for a website (or several), a date range (or for all past data), a segment (or for all segments), there are 3 similar techniques you can use.

1) Use the InvalidateReports plugin

You can use this free plugin by InnoCraft to invalidate your historical data directly within the user interface in just one click: get the InvalidateReports plugin. If you need to often invalidate historical data, this may be the easiest solution.

2) Use a console command

Alternatively you may use the core:invalidate-report-data console commmand:

./console core:invalidate-report-data --dates=2012-01-01,2011-10-15 --sites=1,3,5 --dry-run

3) Use the HTTP API

You can use the API function: CoreAdminHome.invalidateArchivedReports. For example if you imported data in the past for a few specific websites on a couple different dates you could write:

?module=API&method=CoreAdminHome.invalidateArchivedReports&idSites=1,3,5&dates=2012-01-01,2011-10-15&token_auth=xyz

It is possible to invalidate and re-process a segmented report only, simply add to the URL query the segment parameter: &segment=pageUrl=@example.org/contact.

In rare cases you may want to delete reports for a particular period (one of: day, week, month, year, range): setting the &period= parameter to the API call will force Piwik to only invalidate reports of the specified period.

Notes

  • Your historical data will be actually re-processed the next time auto archiving will run. The archiving will re-process the reports data for these particular dates and websites.

  • when invalidating report for a period eg. week it automatically invalidates all periods that include this one, eg. the enclosing month and year. We say the invalidation cascades up. By default, periods that are included are not invalidated (invalidating month will not re-process the days and weeks within the month). You may also force Piwik to invalidate inner periods by setting the parameter &cascadeDown=1.

Any questions?

Many answers and more information about Piwik You can find here:

We are social

Follow us: