Delete old visitor logs from database


#1

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.


(Peterbo) #2

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.


#3

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?


(Matthieu Aubry) #4

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


(Peterbo) #5

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