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:
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?
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
}
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.
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.
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.