How to recover the missing data during Matomo maintenance?
Whenever Matomo is in maintenance mode, no data is being tracked into Matomo. However,there is a way to queue and replay the tracking requests after the maintenance window.
This step is optional. In many cases, upgrading the system will be quick and take only 1-5 minutes. But when the migration includes major database changes, then the upgrade could last for several hours and it becomes critical not to lose this data.
To recover the missing tracking data, you have two options.
- During maintenance, visitors on your websites and mobile apps are still issuing the tracking requests. These matomo.php? tracking requests are stored in your Matomo server access logs files. Once the upgrade to the latest Matomo version is successful,you can create a new log file that contains all these piwik.php requests (for the time window that Matomo was in maintenance mode and not tracking). Then you can replay this log file in Matomo which will backfill all your data. learn more in this FAQ.
- (needs to be prepared and setup before the upgrade).
The second option requires the use of the QueuedTracking plugin with MySQL (or Redis) to queue all tracking requests in a queue which can be replayed after the upgrade is completed. See the steps to setup QueuedTracking in this FAQ. The advantage of this method is that it will be able to recover 100% of all tracking requests, while Option 1 (using server access logs) will not be able to recover the POST requests.