This FAQ will take you through the steps to set up a Windows task which will trigger the processing and archiving of Matomo reports. This will make sure that when you visit your Matomo dashboard, the data has already been processed and Matomo will load reports quickly.

There are two ways to setup archiving for Matomo on Windows: Without logging and with logging, in the FAQ below you will find the steps to setup either method.

Creating a Scheduled Task with logging

  • Create a new text file, and rename it to Matomo-Auto-Archiving.bat (be sure to change the file extension from .txt to .bat)

  • Right click on the Matomo-Auto-Archiving.bat file, and select « Edit »

  • Copy paste the following command into the file:
    C:\PHP\php.exe "C:\path\to\matomo\console" core:archive --no-ansi --url= > C:\path\to\log\folder\matomo-archive.log

  • Replace C:\PHP\php.exe with the path to the your PHP executable file

  • Replace C:\path\to\matomo\ with the path to your Matomo root folder (which includes the « console » file)

  • Replace with the URL to your Matomo instance

  • Replace C:\path\to\log\folder\ with the path where the matomo archive log file containing the last archive output will be written

  • Save the file

  • Search for « Task Scheduler », or press the Windows Key + R and type taskschd.msc and press enter.

  • Click « Enable All Tasks History »

  • Click « Create Task »

  • Name the task e.g. « Matomo Auto Archiving » (in the General panel).

  • Click on the « Triggers » panel and click « New » to add a new trigger.

  • Select to create a trigger after a timetable, to be executed daily and every hour.

  • Go to the « Actions » panel and click « New… »

  • Select « Start a Program » as the action, and put the path to the Matomo-Auto-Archiving.bat file. Eg. C:\path\to\Matomo-Auto-Archiving.bat

  • Click « OK » to close.

Next we’re going to do a test run of the Scheduled Task to ensure it executes correctly.

  • Click on the « Task Scheduler Library » and find the Matomo archiving task, and select it.

  • Click « Run ».

  • There should now be a log file created in the location set in the .bat file. Navigate to that location and open the file. It should show the output of the core:archive command.

The scheduled task will overwrite anything in the matomo-archive.log file and only keep the last archive log. If you would like the logs to persist over time, you may change the single > to a double >> in the command in the .bat file.
Note: Appending to the log file can cause the log file size to grow considerably large, so only enable it when you need to troubleshoot errors with the scheduled archiving process.

Congratulations! You now should have a scheduled task on Windows setup to archive your Matomo reports automatically.
Now that we’ve setup a scheduled task, we can now disable browser archiving to help improve performance.

Previous FAQ: How do I install and configure IIS on Windows for Matomo?