How can I recover lost visits?

Hi all,

I don’t know why but I lost 5 weeks of visits (maybe a token issue). How can I recall these missing weeks please ?



Do you have access to access logs (Piwik machine).

Yes I guess.
How to do it ?

You can replay the data from logs (--replay-tracking option). I mean here requests to /piwik.php resource. See: How do I replay the traffic to Piwik and ingest logs of piwik.php requests? - Analytics Platform - Matomo

Hi quba and thx a lot !

I have to create a delta of my access_log file ? or I have to target the access_log file and piwik will do the sort/differential ?

Best regards,

If you have many frontends, just merge the files and sort by date. The order of requests is important.
Replay only requests where you have gaps on your Piwik reports. You can also check the raw data (piwik_log_link_visit_action table - server_time column which is in UTC).

Hi quba, thx but…

When I launch this :
python --url=http://server.domain.xx/piwik/ --replay-tracking /applis/apache2/htdocs/elmatasite/dif.log

I get this :S

File “”, line 506
level=logging.DEBUG if self.options.debug >= 1 else logging.INFO,
SyntaxError: invalid syntax

WTF ??!!! O_o

Where have I wrong ? Any idea ?
Ps : python 2.4.3 on linux

You have to provide also token-auth or login/pass to a user with access to given websites.

I don’t understand very well. What do you mean ? Do you have an example please ?

I add --token-auth=xxxxxx… --login=superuser --password=suserpass

In vain… :\

version of python can be the issue ?

Python 2.6 or 2.7, see GitHub - matomo-org/piwik-log-analytics: Import any kind of server logs in Piwik for powerful log analytics. Universal log file parsing and reporting.

See also this one regarding token-auth: General - Analytics Platform - Matomo

Dear quba,

why is it import to order the requests by datetime asc? It takes additional resources to merge a bunch of files and to order them by date and time. Doesn’t the Replay Tracking code take this into consideration or at least the archive script from Piwik? I’m just wondering why we need to order the logfiles.


No it doesn’t (at this time)

Thanks matthieu. Does that mean, I could pull the logs from my 2 tracking frontends and load each logfile by executing for every logfile as long as each file is in ascending order? Or is it a must to merge both logfiles, sort them and import them in one execution process of

@Micha2016 it’s recommended to merge these files and order the requests by date. This can be done with a simple script.