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 without logging

  • 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 your php.exe file. Eg. C:\PHP\php.exe

  • Then in the “Add arguments (optional)” field, put the following value:
    "C:\path\to\matomo\console" core:archive --no-ansi --url="

  • 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.

  • 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”.

  • You should then see a console window open with the output from the archiver process:

Creating a scheduled task with logging

If you would like to have logs for the auto archiver, you will need to create a .bat file on the server that we will execute the archive task, follow the steps below to setup archiving 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:\path\to\log\folder\ with the path where the matomo archive log file containing the last archive output will be written

  • 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

  • Then follow the steps as above to add the auto archiving as a scheduled task, but this time in the “Task Properties” field, select the Matomo-Auto-Archiving.bat file instead.

Note: 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?