Error in Matomo (tracker): Invalid idSite: '0'

Hi all.

I’m using Matomo Tag manager tracking an Electron app. I know this is a rather unusual setup, but it works perfectly fine. Up until Matomo 4.x I had no issues. Since upgrading to Matomo 5.x the tracking stopped working. I’m on the latest Matomo release.

First and foremost, there is no site with the ID 0. The only site configured has ID 4.

When I open the application it correctly send the following request to my server requesting the container to respond: "GET /matomo/js/container_WVsEueTV.js HTTP/1.1" 200 172857 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) sleek/2.0.9 Chrome/120.0.6099.276 Electron/28.2.2 Safari/537.36"

In the php log, this error is then thrown: Error in Matomo (tracker): Invalid idSite: '0'

And another log entry is written to my webserver’s log: "POST /matomo/piwik.php?&pf_net=0&pf_srv=0&pf_tfr=1&pf_dm1=15&pf_dm2=108&pf_onl=0&uadata=%7B%7D HTTP/1.1" 400 466 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.276 Electron/28.2.2 Safari/537.36"

As you can see, the first parameter is missing. On my Matomo 4 installation, we would see “idSite=4” here. But with v5 this does not happen anymore. In Matomo nothing is logged.

Diagnostics don’t show any issues.

I’m seeking for guidance on how to track this issue down.


1 Like

sounds like maybe your html file is opened with a “file:” url, you could try adding:


Hi @ransome1
How did you track exaclty?
Looking at your HTTP request, the site ID is missing…

After spending so many hours trying to solve this, fine Sir, you pointed me into the right direction :slight_smile:

In my Matomo container’s configuration, I switched to file tracking (using the UI, not pushing to the _paq array as suggested) and voilá, it is finally working.

Thank you so much!

1 Like