Support » Plugin: Matomo Analytics - Ethical Stats. Powerful Insights. » wrong idSite
Hello, please help … 😉
what was done until now:
Matomo update from 4.2 to 4.3 somehow crashed and let to an white screen of death.
I renamed the Matomo folder and got my site up again.
After that I reinstalled Matomo without problems but now my tracking data was not shown anymore.
I deleted all Matomo related files and database tables.
I installed Matomo again and uploaded a database backup of the Matomo tables. Still data was not shown.
I did some digging in the database and settings and found out that before the crash all data was saved in the database with idSite: 1
Now Matoma tells me in the diganostic tab that my idSite is 2.
* Matomo Version: 4.2.1
* Matomo Blog idSite: 2
* Matomo Install Version: 4.2.0 (Install date: 2021-05-30 20:37:10)
Question: How do I change this idSite back to 1?
Thank you for any hint 🙂
sorry about the trouble. To find out whether the data for idSite 1 is still there you would need to execute below query. This requires access to your database and that you know how to execute a MySQL query. Would that work for you?
In below queries I assume your WordPress DB table prefix is
wp_. If that’s not the case you might have to adjust the queries to your WordPress table prefix. Let me know if you need help finding out that value (it would be shown in the Matomo System Report).
select idvisit from wp_matomo_log_visit where idsite = 1 limit 1;
If this query returns a result then the data is still there. In that case you could try if this makes the previously tracked data show up again:
update wp_options set option_value=1 where option_name = 'matomo-site-id-1';
If this doesn’t work yet then you might need to execute the next query also:
update wp_matomo_site set idsite=1 where idsite = '2';
Does this help @manuel22 ?
Data is still here, I already knew this from my backup.
I’ll try out the rest tomorrow.
I was not aware that Matomo also has information in wp_options.
Glad the data is still there @manuel22 Let me know how it goes and I’ll be happy to help.
Hi, yes it helped. Thank you.
But there’s still somewhere a siteid=2 in the data.
When I open the summary tab Matomo shows me all the data from previous months etc. So this is correct now.
But when I open the “reports” page or “tag manager”, I still get an error message:
An unexpected website was found in the request: website id was set to ‘2’.
I already searched for this in the db, but probably you can tell me faster where to look 😉
- This reply was modified 1 year, 8 months ago by Manuel22.
@manuel22 glad to hear it’s partially working. I wonder if the information is maybe still cached. Could you go to Matomo Analytics -> Diagnostics -> Troubleshooting tab and click there on “Clear cache”? If that’s the problem, it would eventually also resolve itself automatically.
clearing the cache unfortunately didn’t help.
@manuel22 when you click on the reporting link, can you let me know what URL it opens afterwards? Feel free to remove your domain but the path be useful. I’d just like to check if it mentions idSite 1 or idSite 2 there. I looked in the code and it should be using the idSite 1 ( as configured in
The strange thing (and I noticed already before), indeed it shows idSite=1.
But the site still shows me this error message:
An error occurred
An unexpected website was found in the request: website id was set to ‘2’ .
- This reply was modified 1 year, 8 months ago by Manuel22.
Does the entire page say that or is the page loading partially?
Any chance you could create another user in your WordPress (for example an administrator) and see if the same error happens there?
Sorry it’s taking a while. It’s one of those things that’s very likely very quick to find out when you have access to WordPress and the database but hard to know what it might be otherwise.
I had other things to do, but here we go now… It looks like this:
And indeed: With another user it works as expected. There I don’t get this error message.
Thank you for the screenshot @manuel22 This helps. Could you add the following line to your wp-config.php?
I think then we should be able to see the trace that leads to this error and understand things better. The screen should basically change slightly and show a few file names and line numbers.
Thats the new stuff:
#0 /home/example.com/public_html/wp-content/plugins/matomo/app/plugins/SitesManager/API.php(244): Piwik\Site::setSiteFromArray()
#1 /home/example.com/public_html/wp-content/plugins/matomo/app/core/Site.php(480): Piwik\Plugins\SitesManager\API->getSiteFromId()
#2 /home/example.com/public_html/wp-content/plugins/matomo/app/core/Site.php(520): Piwik\Site::getFor()
#3 /home/example.com/public_html/wp-content/plugins/matomo/app/plugins/Dashboard/Menu.php(25): Piwik\Site::getNameFor()
#4 /home/example.com/public_html/wp-content/plugins/matomo/app/core/Menu/MenuTop.php(55): Piwik\Plugins\Dashboard\Menu->configureTopMenu()
#5 /home/example.com/public_html/wp-content/plugins/matomo/app/core/Plugin/Controller.php(681): Piwik\Menu\MenuTop->getMenu()
#6 /home/example.com/public_html/wp-content/plugins/matomo/app/core/Plugin/Controller.php(606): Piwik\Plugin\Controller->setGeneralVariablesViewAs()
#7 /home/example.com/public_html/wp-content/plugins/matomo/app/plugins/CoreHome/Controller.php(173): Piwik\Plugin\Controller->setGeneralVariablesView()
#8 /home/example.com/public_html/wp-content/plugins/matomo/app/plugins/CoreHome/Controller.php(207): Piwik\Plugins\CoreHome\Controller->getDefaultIndexView()
#9 [internal function]: Piwik\Plugins\CoreHome\Controller->index()
#10 /home/example.com/public_html/wp-content/plugins/matomo/app/core/FrontController.php(615): call_user_func_array()
#11 /home/example.com/public_html/wp-content/plugins/matomo/app/core/FrontController.php(167): Piwik\FrontController->doDispatch()
#12 /home/example.com/public_html/wp-content/plugins/matomo/app/core/dispatch.php(32): Piwik\FrontController->dispatch()
#13 /home/example.com/public_html/wp-content/plugins/matomo/app/index.php(25): require_once(‘/home/ff-eic…’)
Great thanks. I now fully understand the problem.
Executing below queries in your database should make this work again. Please note in the last query you need to replace
$USERNAMEwith your WordPress username:
DELETE from wp_matomo_site where idsite = '2'; DELETE FROM
option_namelike '%_defaultReport'; DELETE FROM
idsite= 2; INSERT INTO
autoload) VALUES ('$USERNAME_defaultReport', '1', 0);
The last query may not be needed. I checked in the code and usually if the site was deleted this problem would not happen. It’s only happening because the site IDs were changed manually.
Let me know if this helps @manuel22
Hi @manuel22 have you had a chance to look at my last comment? I’ll mark this issue for now as resolved due to inactivity but happy to follow up if there’s still an issue. Simply comment in that case.
Hi, thank you.
I forgot about this issue a little bit. But just now I managed to fix it.
I didn’t follow your instructions completely because I was a bit afraid of deleting multiple %_defaultReport entries.
But this finally pushed me in the right direction and I found the one entry “wp_admin_defaultReport” which showed a “2” in the values. I just changed it to “1” and now everything works as expected again.
Thank you very very much 🙂
- This reply was modified 1 year, 6 months ago by Manuel22.
- The topic ‘wrong idSite’ is closed to new replies.