Piwik and Site Optimising problem

Hello everyone
In the past my husband installed PIWIK on our site, and on some of our client sites. Sadly he passed away and I am now attempting to learn how to manage some back end issues on my two business sites.

I have received a report from SEMrush on problems with my site that impact the SEO. One of these is a message about the PIWIK. I believe this is because the address is http and not https.

The error message is about this line: http://mywebsites.com.au/statistics/piwik.php?idsite=1

Being a complete newby I would appreciate some simply worded (wink) advice on how I might change this to https.

Many thanks

Hi, I hope I can help you.

Can you give me more details about the error?
While I would recommend using HTTPS for Piwik, not doing so shouldn’t create an error in general.

Maybe it is a false alarm by the SEO tool. While piwik technically does “slow down” a page as it needs to send two additional requests, this should not influence any website user as it is done asynchronous (so it only starts loading after the rest of the page has finished loading and the website is usable)

Hello and thank you for responding.

The only other info I have is that the error is about Mixed Content - the description is as follows:

_“If your website contains any elements that are not secured with HTTPS, this may lead to security issues. Moreover, browsers will warn users about loading unsecure content, and this may negatively affect user experience and reduce their confidence in your website. HOW TO FIX IT Only embed HTTPS content on HTTPS pages.”

And this is the link it is pointing out:
https://mywebsite.com.au/about-us/testimonials http://mywebsite.com.au/statistics/piwik.php?idsite=1



I think I understand the issue now. Your website is served via a secure connection (HTTPS), but your piwik isn’t. As embedding scripts from unknown sources defeat the purpose of HTTPS, browsers show a warning about “mixed content” and don’t show the page as secured.

The simples solution would be to also enable HTTPS for your Piwik setup. How to do this depends on where you are hosting your website. I assume you don’t have an own server, but host it at a shared hoster. Then you’ll need to contact them and but a SSL Certificate from them (which unfortunately still cost quite quite a bit per year, unless they offer to setup let’s encrypt for you which offers free SSL certificates)

I just noticed that your website piwik setup is in a sub directory of your website. (So in yoursite.example/statistics). In this case the solution is quite simple: As you should already be able to access https://yoursite.example/statistics/ via HTTPS you just need to change the tracking code.

It should look like this and is included in the website header:

            <!-- Piwik -->
        <script type="text/javascript">
            var _paq = _paq || [];
            (function () {
                var u = "http://yoursite.example/statistics/";
                _paq.push(['setTrackerUrl', u + 'piwik.php']);
                _paq.push(['setSiteId', 2]);
                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 + 'piwik.js';
                s.parentNode.insertBefore(g, s);
        <!-- End Piwik Code -->

and you’ll need to change the var u = "http://yoursite.example/statistics/"; line to var u = "https://yoursite.example/statistics/";

If you want to you can send me a direct message with a link to your website and I can explain more detailed how to change this.

Thanks again for getting back to me.
Oh dear, I may be out of my depth now. This is something I would need to do through CPanel? I have no idea how to do this. The site is a Joomla site and I do have access to some of the site files internally but I don’t know which ones to look for.

I haven’t used Joomla before. But either you are using the piwik extension nfrpiwik and you can change the settings inside Joomla or the tracking code was manually added to the template, in which case I unfortunately can’t help you finding it (Maybe download all files and search for End Piwik Code in them).

thank you again.
I don’t see it in extensions but I’ll check what html files I have access to.

I really appreciate your help. :smile:


So, following on from my last message I just managed to get the cpanel log in. Under Apps I can see Piwik - in fact I can see two installations? It has a location path which I’ve changed to https…hoping that is enough! But I’ll also check the code as you suggest as I also have FTP access. Might take me a day or two to get to this.