Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Matomo: Visitor could not be found #16359

Closed
ghost opened this issue Aug 31, 2020 · 7 comments
Closed

Error in Matomo: Visitor could not be found #16359

ghost opened this issue Aug 31, 2020 · 7 comments
Labels
answered For when a question was asked and we referred to forum or answered it. Can't reproduce (yet) For issues that are reported by several people, but can't be reproduced reliably and need more data

Comments

@ghost
Copy link

ghost commented Aug 31, 2020

Hello everyone,

My matomo generates lots of error_log entries when I click to view a visitor's profile:

Error in Matomo: Visitor could not be found
Error in Matomo: Visitor could not be found
Error in Matomo: Visitor could not be found
Error in Matomo: Visitor could not be found

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.

@tsteur
Copy link
Member

tsteur commented Aug 31, 2020

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?

@tsteur tsteur added the Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. label Aug 31, 2020
@ghost
Copy link
Author

ghost commented Aug 31, 2020

It happens when I click on the "profile" icon (marked in the screenshot below)

matomo-error-profile

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.

@tsteur
Copy link
Member

tsteur commented Aug 31, 2020

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.

@ghost
Copy link
Author

ghost commented Sep 1, 2020

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:
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.

@tsteur tsteur added Can't reproduce (yet) For issues that are reported by several people, but can't be reproduced reliably and need more data and removed Waiting for user feedback Indicates the Matomo team is waiting for feedback from the author or other users. labels Sep 1, 2020
@tsteur
Copy link
Member

tsteur commented Sep 1, 2020

@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.

@ghost
Copy link
Author

ghost commented Sep 2, 2020

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.

@ghost
Copy link
Author

ghost commented Dec 22, 2020

Fixed after upgrade to v4

@ghost ghost closed this as completed Dec 22, 2020
@tsteur tsteur added the answered For when a question was asked and we referred to forum or answered it. label Dec 22, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it. Can't reproduce (yet) For issues that are reported by several people, but can't be reproduced reliably and need more data
Projects
None yet
Development

No branches or pull requests

1 participant