Delete old visitor logs from database

on the admin page for this setting it says:

“Delete logs older than x days
Please specify a number of days greater than 7.”

If I set this to 8, how does piwik process unique visitors for a whole month? I assume it can’t, so that should be mentioned.

If you have correctly setup your daily cronjob (as described in the feature), monthly reports are generated from the processed archives, not from the table you are deleting logs from.

I am not sure if this is correct. If you look at Piwik_ArchiveProcessing_Period::computeNbUniqVisitors it says:

"Processes number of unique visitors for the given period

This is the only metric we process from the logs directly,
since unique visitors cannot be summed like other metrics."

And sure enough the query just counts the distinct visitor ids in the log_visit table for a period of time.

Can one of the developers confirm that there is something else going on that keeps monthly unique visitor counts “accurate” when you keep less than 30 days of history?

if you delete logs, Unique visitors for the month will not be accurate. Maybe we should recommend setting more than 30 for deleted logs?

There is a small mention in the FAQ: How to - Analytics Platform - Matomo

Thanks for clarifying that, matt. It seems like I skipped the “unique visitor” phrase while reading…