This guide will show you how to install Matomo via Plesk 18.0.21.
Prerequisites: PHP CLI and PHP MySQL PDO driver (or Mysqli driver) will need to installed and running.
If you already have a website configured you may want to create a subdomain for Matomo to be installed into (e.g matomo.example.com), alternatively you can create a folder called for example “matomo” and reference this folder for your installation (e.g example.com/matomo). This guide explains how to install Matomo using both methods.
Login into your Plesk and choose Websites and domains from the left navigation menu.
There are two methods to upload Matomo to Plesk
b. (Faster method) Upload the zip file using the file uploader option in Plesk.
Select the matomo zip file, Plesk will ask for unzip location.
Click Ok to unzip Matomo. This can take some time depending on the performance of your webserver.
Once the files have been uploaded or unzipped, browse to your subdomain or folder containing the installation. This could be https://analytics.example.com in this example, or https://example.com/matomo if you have installed Matomo in a folder.
The installation procedure for Matomo will begin.
Check all the requirements are met for your installation.
Create the database and user for the database.
Take note of the database server hostname, the database name, the database user name and password: these details will be required during the installation.
Confirm the user has all the privileges required to access the database.
Complete the rest of the installation.
Configuring the archiving
Now that the installation is complete, we will setup a scheduled task (cronjob) to trigger Matomo archiving
- Select Tools and Settings from the left hand navigation menu.
- Select Scheduled task (Cron jobs) from the Tools and Resources menu.
- Select Add task
- Select Run a command.
- Enter the following command in the Command field, edit the command to match your needs first.
php /var/www/vhosts/example.com/matomo.example.com/console core:archive --no-ansi >> /path/to/logs/cron-matomo-archive.log
The path typically for Plesk will be
/var/www/vhosts/domain. If you are on shared hosting, please check with your hosting company. The path to the cron-matomo-archive.log file can be to a folder of your choice.
- Set the frequency to “Run Hourly” as we want the cron to run every hour.
- Set “Notify” to “Every time”.
- Select Run Now and confirm the cron job is run successfully. Click ok to save the cron job, the cron job should now be listed in the configured cron jobs.
Disable Web Application Firewall (ModSecurity)
If you have enabed Web Application Firewall (ModSecurity) in Plesk, you will need to disable it for your Matomo domain:
- In Plesk, in the left sidebar, click Websites & Domains.
- Select the Matomo domain, and then click Web Application Firewall.
- In the Web application firewall mode section, click Off
- Click OK. Plesk will disable the Web Application Firewall for your Matomo domain.
Congratulations, you have successfully installed Matomo Analytics through your Plesk!
The next step is to include the Matomo Tracking Code in your websites to start tracking your website and app users.