Realtime tracking dead in 1.6

(Kip) #1

Hey folks. I’ve upgraded to 1.6 from 1.5 smoothly and there didn’t appear to be any errors. I use Piwik to track three different sites. Under the Visitors in Real Time gadget, on one site it tracks just fine, but on another it does not track any pages and just seems to list everything as “Direct entry”.

It’s one Piwik installation on one server hosting both sites. Other than the upgrade, nothing else has changed. Any help appreciated.

(kid77) #2

Same here. Reported the problem in the German forum days ago without any solutions so far.

(Kip) #3

Bummer. Let me know if you hear anything in that forum. I still haven’t found a solution yet.

(Matthieu Aubry) #4

Did Referrers tracking use to work with 1.5.1 and now it doesn’t with 1.6 ?

What is your website URL? See : Troubleshooting - Analytics Platform - Matomo

(Kip) #5

Hey Matt. Yes, whatever the version that preceded 1.6 was, it worked with referrer / visitor tracking on all my sites. Now it only seems to work on one of them.

The one that works:

The one that doesn’t:

Thanks for your help. We all really value the generous work you’ve put into Piwik.

(Kip) #6

Hey Matt. Any luck?


Same problem after updating to 1.6

(Kip) #8

Hopefully Matt or somebody figures it out. I’m still having the same problem as well.

(Matthieu Aubry) #9

thevertigo, thanks for the report. The problem is the automatic http -> https redirection on your piwik server.

I have edited the FAQ “No referrer data in piwik” and added the following

Check that the Piwik domain name in your Javascript tracking code is correct (this URL is in the second line of the Piwik tracking code).
There have been cases of missing referrers when the Piwik JS code in the pages points to a URL that returns a 302 response instead of the final destination. It seems that some webserver compromise the tracking request when such redirects occur. Check in particular if the URL (doesn’t) contains “www.”. Also, if the server does an automatic redirection from http to https which also affects tracking requests to piwik.php, it might create problems such as missing referer data. Make such any http->https redirection excludes piwik.php requests.

(Kip) #10

Hey Matt. Thanks a lot for your help. My tracking code on the https domain looks like this currently:

According to the FAQ, am I to understand that it should look like this?

var pkBaseURL = (("https:" == document.location.protocol) ? "" : ""); ... rest the same

(Matthieu Aubry) #11

No the problem is that you have a redirect on your server (apache htacess for example) that redirects to which creates a bug (not piwik’s fault, web server bug)

(Kip) #12

Hey Matt. I understand. I need the redirect from http to https for security reasons. Since it was working just fine before the upgrade to 1.6, it must be a bug in piwik since this kind of redirect isn’t really considered a bug in Apache, but a pretty standard type of redirect. Do you have a workaround?

(Matthieu Aubry) #13

The problem is that the redirect, also re-encodes the parameters to piwik.php and then they are double encoded causing them not to be picked up by piwik.

Advice: Disable auto https redirection for requests to piwik.php

Otherwise, change http:// to https:// in your tracking code to always load it directly from https, that might fix the issue?

(Kip) #14

Ok, thanks Matt. I’ve changed it to this now:

<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "" : "");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 3);
} catch( err ) {}
</script><noscript><p><img src="" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->

I will let you know if it works. If it does, it might be a good idea if the code that generates the tracking code is patched to write out https instead of http when piwik is accessible only over https.

(Kip) #15

Hey Matt, it works! Thank you so much! I really suggest now that the piwik generation code spits out https instead of http if it knows its being hosted over https. Would probably save a lot of headaches.