Skip to main content

Matomo for Joomla

As with the code for the Google Tags Manager, probably the most efficient way to add the tracking code for Matomo analytics is to add it directly into your template.

If for any reason you can not add the code directly, this plugin will inject the code into the <head> section of each page.

There are two methods to add the code: script where you simply copy and paste the matomo code and manual where you set the parameters one by one.

Mode: Script

In this mode, you must enter the Matomo code into the field Script body.

The <script>,</script> and HTML comments (<!-- -->) should be omitted and are filtered.

Be aware that any JavaScript can be entered into the Script body, however only an administrator can edit the plugin settings.

If you want to track logged in users, add the following to the JavaScript and enable the option.

_paq.push(['setUserId', '{userId}']);

Mode: Manual

Here, you must enter all required parameters manually.

Require (cookie) consent

These options allow to pause (cookie) tracking until the visitor gives consent. You will need some other script to enable normal tracking. See the Matomo website for details.

Track Logged-in users

Matomo allows tracking users by ID, with the option set to 'By ID' the Joomla User ID is added to the tracking. (For the script mode you will need to add some code, see above). Guest are tracked as 0 (zero).

Set to 'No' to disable tracking of logged-in users.

Set to 'Yes' to track logged-in users without the user-id

Track administrator too

If for any reason you want to track visits to the administrator as well, enable this option.

Cloaking Matomo

The Matomo endpoints matomo.js and matomo.php are present in all add and privacy blockers. As a result, you will miss quite a few visitors in your analytics. To prevent this, you can change the endpoints. Below some examples. These are also possible without the plugin.

Destination for the tracker

Change the value from matomo.php to q, then add a rule to your .htaccess:

#only needed once
RewriteEngine On
RewriteRule ^/?q$ matomo.php [L,QSA]

Name of Matomo Javascript file

Change the value from matomo.js to scroll.js, and add a rule to your .htaccess:

#only needed once
RewriteEngine On
RewriteRule ^/?scroll.js$ matomo.js