Closed ghost closed 3 years ago
Hi @robo2bobo thanks for creating this issue. This would be expected behaviour when a requested visitor cannot be found. How exactly do you trigger this error?
It happens when I click on the "profile" icon (marked in the screenshot below)
If I keep clicking on the icon, it just generates more of those errors. Every other profile on the page works fine and their profile details modal window appears fine.
Eventually the "broken" user will disappear from the dashboard, as new users visit the site. But, after a few weeks or so, I'll find another profile that does not open and produces the same error.
Are you maybe using Matomo's userId feature? or have a consent screen on the page and dynamically enable/disable cookies in the JavaScript tracker? It's possible that the visitorId changed and then the link ends up broken until the next refresh.
I managed to find another case that causes this error. I've gathered the following information:
visitor id: 33a6888c3a641432 visit id: 148830
View profile button html:
<a class="visitor-log-visitor-profile-link visitorLogTooltip" data-visitor-id="33a6888c3a641432">
<img src="plugins/Live/images/visitorProfileLaunch.png"> <span>View visitor profile</span>
</a>
XMLHttpRequest request executes when clicked:
index.php?date=today&module=Live&action=getVisitorProfilePopup&visitorId=33a6888c3a641432&idSite=1&period=day
Raw data returned from the request:
<div class='alert alert-danger'><strong>Error:</strong> Visitor could not be found</div>
Screenshot of problematic profile:
Regarding your question, the userid module is enabled in my installation, but I am not using it. I use the matomo-php-tracker but I am not using the setUserId() feature.
@robo2bobo it sounds to me like some implementation issue in your PHP tracking. Is there any chance that some requests might change the visitorId? If you send a visitorId with every request, could this ID change somehow? If you don't send a visitorId, you need to make sure that you always send the same user agent etc for that visitor.
In case you have some technical experience you may want to enable the tracker debugging for a short time until this issue happens again. While you have this enabled you will also want to enable logging to a file. When you then experience this issue again, I'd check the logs for that visitId. This might explain what's happening.
First of all, thank you for taking the time to debug my problem. I appreciate it.
About my PHP implementation, I've been using the same code for years, since the "piwik" days and never had this issue, the errors started happening over the past few months. To be more specific, at the end of my index.php I have the following code:
require_once("MatomoTracker.php");
$matomoTracker = new MatomoTracker((int)$MATOMO_ID, $MATOMO_URL);
$matomoTracker->setTokenAuth($MATOMO_TOKEN);
$matomoTracker->setRequestTimeout(4);
$matomoTracker->doTrackPageView($title);
I am going to enable debugging and logging to a file and see if I can get more information. I think you are right about your initial observation, that the visitorId changed somehow.
Fixed after upgrade to v4
Hello everyone,
My matomo generates lots of error_log entries when I click to view a visitor's profile:
Unfortunately, these errors are not consistent, they may appear 1 out of 50 profiles. In the 49 cases the profile modal window opens fine, but in the 1 broken case, the modal window does not open. The only consistency, is that the profile that causes the error never works, it will always remain broken no matter what.
I am running matomo 3.14.0 on a CentOS 8 server with php 7.3.5.
Thank you.