Goofed up the Matomo Installation - and now not tracking any data

Have recently installed Matomo on an Azure VM from where we will track the Web Traffic & Analytics.

Steps taken are as follows:

  1. Spin up Azure VM with Ubuntu 18.04
  2. Set up a LAMP stack on the Ubuntu 18.04 (https://docs.microsoft.com/en-us/azure/virtual-machines/linux/tutorial-lamp-stack; followed the Steps up till Installing Wordpress, not beyond)
  3. Downloaded Matomo and extracted to /var/www/html/ (https://www.linuxcloudvps.com/blog/how-to-install-matomo-on-ubuntu-18-04/; Step 6 only)
  4. Accessed & set up Matomo via the usual GUI installation (https://www.linuxcloudvps.com/blog/how-to-install-matomo-on-ubuntu-18-04/; Step 8)
  5. Installed the Matomo tag on a Wordpress website > Appearances > Theme Editor > Theme Functions/functions.php file > (below code)
<script>
  var _paq = window._paq = window._paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//<Azure VM Public IP address>/matomo/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '3']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
  })();
</script>

However, while Matomo on the Azure VM detects a Wordpress website, it is unable to track any traffic and/or activity on the Wordpress website.
Below are some of the errors:

Additionally, can share the system check if it helps.

Unsure where I have gone wrong in the setup - and how to rectify this.

I don’t think the no-tracking behaviour is related to the error displayed (the error is just a security error)
I am not very aware about the WP configuration and behaviour with Matomo, but did you add the tracking code available there?

Thanks for the quick revert, @heurteph-ei.

Yes - having installed Matomo on a few other servers, have never noticed the security concerns being associated with the no-tracking issue.

Also, yes - have placed the Tracking Code on the WordPress website (referenced in step 5).
The code is placed in the Wordpress website > Appearances > Theme Editor > Theme Functions/functions.php file

Code is as follows:

function ns_google_analytics() { ?>

<!-- Matomo code-->
<script>
  var _paq = window._paq = window._paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="<Azure VM Public IP Address>/matomo/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '3']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<!-- End Code -->

  <?php
}

Hi,

I think your issue might be related to this. If your website is using HTTPS, then it is not allowed to load your Matomo script from a non-HTTPS site. And your Matomo should use HTTPS anyway as otherwise you are transferring peoples personal data for everyone to read without encryption over the internet.

But to find out what is the actual issue, you need to check your browsers developer tools on the tracked site and look for errors in the javascript console.

1 Like

Hi @Lukas,

Thanks for the heads up - you’re right: the server with Matomo should anyways have HTTPS enabled; just enabled the same.

However, while that has ensured that the Matomo JS calls on the Wordpress website now return a 200 HTTP Response (which is good), the Matomo backend (dashboard & database) still do not recognize any visits/incoming traffic.

Here is the screenshot of the Console output - no errors out there either.

The fastest way to find out whats going wrong is, to temporarily enable https://developer.matomo.org/api-reference/tracking-api#debugging-the-tracker and then check the response to the matomo.php response in the network tab.
Matomo should respond with a verbose log on why this request is (not) stored.

Maybe you have DoNotTrack enabled in your browser.

1 Like

Hi @Lukas,

The debugger worked perfectly well:

  • the verbose log informed tracking was being done
  • somehow, my browser (laptop and 2 phones) had the DoNotTrack header found
  • Matomo now tracks visits from other devices

Thanks! :smiley:

1 Like

Hi @Lukas,

Any thoughts on how one to resolve the Private Directory / File Security issues indicated in the 1st topic message?
Thanks in Advance!

Hi,

I wrote about it a few times before:

Essentially Matomo checks if those files are publicly available (as in every person on the internet can access them. This should be avoided and therefore Matomo creates .htaccess files to deny access.
For whatever reason they don’t seem to be working for you. Either you don’t use Apache and need to change the server setting or you have disabled htaccess support in Apache.

1 Like