First time user: cannot get matomo to work

Hi everyone, I have been trying to set up matomo, but I am getting a few errors I cannot seem to fix on my own, and so I need some help from someone more experienced than myself.
I use matomo via the wordpress plugin, combined with Cloudflare. I followed the guidelines to enable cloudflare cdn via matomo.

The issue(s): when I enable ‘tracking code’, I get a warning (front-end) about double registration of the setTrackUrl, setSiteID and enableLinkTracking. See screenshot…I understand this means I have two trackings enabled but I cannot see where I need to fix this…I’ve been searching the web since yesterday, and LOTS of info but NO solution to be found. People with solutions tend to be extremely vague in their sharing of them.

The other issue is that https//matomo.org/matomo.js is blocked due to mime type mismatch (server sees this as (text/html); again there are loads of people with this issue, but no solution whatsoever. See screenshot 2. The yellow warning the the matomo.js cannot be loaded seems a consequence to the mime mismatch…Can i add the js filetype to htaccess, would that work for this, or is the issue deeper?

Please help? I’m sure these are just some settings I’m overlooking… (I’ve pasted together 2 screenshots into one, because of the (frankly 'useless) rule of only one image for new users…these are still TWO images, made into one, so what’s the difference?).

The second screenshot is when I disable matomo tracking code…


Anyone?

I was told by matomo support to copy the plugin report and then come here for support but I can’t paste it in the post and I cannot add it in attachment. WTF ???

LINK to the d*mned report:

https://gofile.io/d/qTAr4U

It would be really nice if someone would be nice enough to help me out.

I can see several errors and warnings in the report but I’m on shared hosting, and one of the things I can already see is that the max allowed packet size of my db cannot be set higher. I can change the max upload size and things like that through the htaccess file, but I cannot access php.ini or my.ini or stuff like that. Just starting out with a website so not really going to plan upgrading anything as of yet…pls just ask for additional info, I’m actively engaging in this now…I’d like to have matomo up and running smoothly. thanks.

Hi,

Please be aware that time zones exist and most people here on the forum help others in their free time.

Where do you get that URL from as it does not exist (https://matomo.org is the website of the project).

If you mean https://www.cloudflare.com/apps/piwik then this is the issue. The Matomo Wordpress plugin contains everything that is needed for the tracking and embeds the tracking code into the website. The Cloudflare app allows you to embed the tracking code into a website served by cloudflare, so this means you have now embedded the tracking code twice (as the error message says).
So you don’t need the cloudflare app at all in your case.

Well yes, I use cloudflare plugin and the matomo plugin. I enabled the CF api in matomo as I said in the original post. Also the screenshot shows the url. It loads on my homepage and throws that error each time. If I don’t need cloudflare, then why is there an option to enable and enter the cloudflare API through matomo settings ? I would like to use both if possible, as many also do…matomo is for tracking but cloudflare is CDN, no ??? I feel it is better to use both since matomo is not a CDN.

to be clear: I use the cloudflare plugin and the matomo plugin in WORDPRESS. Cloudflare for the CDN, and matomo for the statistics…I have entered the cloudflare api key in the matomo CDN settings, so that should mean that matomo and cloudflare now work together…I though that was sufficient…

thanks for responding. Of course nobody here sees I’ve been pushed around for many hours before coming here. I realize very well that there are timezones and that people sleep. No need to point it out. I’ve waited patiently for hours since the last reply. Thanks.

Hi,

I’m still a bit slow. Can you please explain (ideally with a screenshot) which setting exactly you are referring to?

Wow…and I’ve been up for way too long, because I’m mixing things up. As you already hinted, there is no such option, that’s litespeed… So,…euh,… scrape that, that is a litespeed setting.

What I mean is that I want to use cloudflare for just the cdn, and matomo for tracking, but I guess I’m not setting it up properly.

In any case, it seems to be running except a few minor issues as it states, mainly a max packet size of only 16MB which needs to be at least 64, but I’m on shared hosting so cannot change that; and also mem limit of 256mb which may turn out to be too scarce…

The issues I was eluding at in the first post, still occur though. When I load the homepage and deploy dev tools > Network, there’s always the same error of that url blocked for MIME type mismatch, and the others pointed out there in that first screen. I would want to see those fixed because they are unneeded waste of resources for the user if they keep loading each time…

Hi,

That explains that.

I am not too familiar with Cloudflare, but you might be able to set it up so that it caches wp-content/uploads/matomo/matomo.js and then replace the tracking code in the settings with one that points towards the cloudflare CDN.

While it would be great if you could increase those limits, Matomo should work fine as is unless you track a huge amount of visitors.

Regarding the MIME issue, it happens because you try to load https://matomo.org/matomo.js which is a normal 404 page as this URL doesn’t exist. I am not sure where it comes from.

Could it have been added in the code somewhere? Guess I need to check that…
I’m only starting out with this, so what would be the best approach to go search for that redundant code? Any way to determine in which file it might be injected?

So I need to point cloudflare cache to the matomo.js file on my server and replace the tracking code in matomo settings to make it point to cloudflare?

As far as I can see, I have no control over cloudflare caching except this (screenshot 1), and then also purge and development mode…I am on their free plan.

But checking now, it seems that double instance has gone away. I have no clue why…see screenshot 2.
Only the false url remains. Also another js MIME mismatch from litespeed but that’s besides this point.

So I guess I need to look for that url in the code somewhere. Again: what would be a good approach to search for it?

It seems that matomo is running ok now though, no more double flags…no more conflicts. Except mem limit and max packet size there are no more error logs and warnings in the report…

Still can’t find where matomo.org/matomo.js comes from. Indeed very strange …

Hi,

In your website source there is a second tracking code (in addition to the working one created by the Matomo plugin

<script type="text/javascript" class="cmplz-stats cmplz-native"> var _paq = window._paq || [];
    _paq.push(['trackPageView']);
    _paq.push(['enableLinkTracking']);
    (function() {
    var u="https://matomo.org/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '1']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>

Ok, I think I know what is causing this. In the complianz plugin, you can set the siteID of matomo (which is “1”) and let complianz take care of the matomo tracking process.

I’m guessing that, instead of taking over, they indeed duplicate the process. Make sense ?

It means I need to report this to them…meanwhile I’ll try disabling that setting and see what’s what. …this is helpful! thanks.

Here it is. ‘Recommended’ to leave on or shut this down? Because the mismatch seems to come from entering that url and letting complianz eff it up :stuck_out_tongue:

Hi,

That makes sense. In that case you can simply ignore the feature in complianz or instead disable the tracking code of the Matomo plugin and then enter the site id 1 and the correct URL to the matomo.js there.

Yeah, I already disabled it and emailed the issue to complianz team…

I also took care of the remaining two warnings of js mismatch. I now have a clean front-page.

Thank you kindly for your assistance.

Quick other question: I have Pagespeed Ninja running, seems to work very good.
But can I use a cache plugin in combo with it? Do i need it? I see others disabling ninja cache but use it for the other features, then use super cache or something with it…just want to know your opinion. My page-load is about 98% on GTmatrix, so not too bad already…