Why "Invalid idSite: '0'" is PHP error?


I periodically check site logs and see about ~400 errors per month like this: “Error in Matomo (tracker): Invalid idSite: ‘0’”.
I investigated the problem. It is somehow connected with UCBrowser V7.0.185.1002. The first visit from this browser generates a very strange request to piwik.php. But it is not a problem.

My question is: Why “Invalid idSite: ‘0’” is written to PHP error log at all? It is not a software problem. It is not an error. I think some bots can try to generate requests with wrong site IDs or without it at all.
It floods PHP error log and I can occasionally miss some real error.

I plan to modify \core\Tracker\Response.php

public function outputException(…)
+++ if ($statusCode == 500)

but it is not a good solution because I should restore it after updates.

Is it possible (or planned) to make logs more versatile?

(Redneck Bob) #2

At the bottom of my tracker I have this line which is called by the browser if JavaScript isn’t enabled.

<noscript><p><img src="//rats.vsonline.com/piwik/piwik.php?idsite=1&rec=1" style="border:0;" alt="" /></p></noscript>

The documentation is all over the map with this, but the ‘idsite=’ should be lower case. If you use ‘idSite=’ with the uppercase S, this will cause the “invalid idSite: 0” error.

Change “idSite=” to “idsite=” and that should solve the issue.

(Lukas Winkler) #3


Can you point to the docs that are incorrect, so that they can be changed?


Thank you for your reply.
Our site has not noscript section for Piwik.
I can try to catch correct and wrong requests if needed.

But my main question was about logging.