Install Matomo (Piwik) like Roundcube

Discussion in 'Tips/Tricks/Mods' started by MyNameIsSteve, Nov 7, 2021.

  1. MyNameIsSteve

    MyNameIsSteve New Member HowtoForge Supporter

    Their website is
    Is there a way to install Matomo analytics like Roundcube?
    I would like to install once and make available for all websites with an ALIAS. I host a dozen sites and want to maintain my ISPconfig integrity. As a last resort I could install it individually to each site but that seems overkill.
    On a default install you get something like It strikes me that this could be very similar to roundcube's
    With recent browser updates (testing on Brave) I get a failure (blocked) if I place the tracking code in a second website such as and it points to

  2. till

    till Super Moderator Staff Member ISPConfig Developer

    I guess it might work to use one central installation, but never tried that. E.g. create a directory /var/www/matomo and put the matomo files into that directory and chown them to www-data user and group. Then use a similar config to phpmyadmin:

    Alias /analytics /var/www/matomo
    <Directory /var/www/matomo>
     Options FollowSymLinks
     DirectoryIndex index.php
      AllowOverride All
      <IfVersion >= 2.3>
        Require all granted
      <IfVersion < 2.3>
        Order allow,deny
        Allow from all
     <IfModule mod_php7.c>
     AddType application/x-httpd-php .php
    That's just to get an idea how it might work and there might be additional settings required, have not tested that.
  3. MyNameIsSteve

    MyNameIsSteve New Member HowtoForge Supporter

    Thanks Till,

    It works.Your help got me what I needed. Below is a brief summary.
    1) Install Matomo to an existing website to a temp dir such as
    2) Create the directory /var/www/matomo
    3) Move the contents of temp-matomo to /var/www/matomo
    4) Run chown -R www-data:www-data /var/www/matomo
    4) Delete the temp-matomo direcory
    5) Create an etc/matomo directory
    6) Create etc/matomo/apache.conf file with your ALIAS code snippet from above
    7) Create a link file /etc/apache2/conf-available/matomo.conf pointing to etc/matomo/apache.conf
    8) Create a link in /etc/apache2/conf-enabled pointing to ../conf-available/matomo.conf
    9) Restart apache
    10) Go to

    This gets things working better with one install and multiple web sites, but ublock origin is still catching it.
    I made links to matomo.js and matomo.php (test.js and test.php) and change the tracking code to match.
    This almost worked, but ublock origin was still catching it. I found a web post stating to add a / to test.php and now it seems to work.

    <!-- Matomo -->
      var _paq = window._paq = window._paq || [];
      /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
      (function() {
        var u="";
        _paq.push(['setTrackerUrl', u+'test.php/']);
        _paq.push(['setSiteId', '3']);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.async=true; g.src=u+'test.js'; s.parentNode.insertBefore(g,s);
    <!-- End Matomo Code -->
    I will have to do a bit more testing to be sure.
    till likes this.
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Thanks for documenting the steps in detail! I'll move the post to the tips & tricks forum to find it easier in the future.

Share This Page