matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.94k stars 2.66k forks source link

[Bug] Visitor showing as "returning" but visitor profile only contains 1 visit #22403

Open peterbo opened 4 months ago

peterbo commented 4 months ago

What happened?

Visitor showing as "returning" but visitor profile only contains 1 visit. Happens multiple times (not only a glitch with 1 session)

returning-but-only-one-visit

What should happen?

For visitors marked as "returning", at least 2 visits should be in the visitor profile

How can this be reproduced?

I can't open the visitor log on demo. Will try to reproduce elsewhere

Matomo version

5.1

PHP version

8.3

Server operating system

Debian 11

What browsers are you seeing the problem on?

Not applicable (e.g. an API call etc.)

Computer operating system

No response

Relevant log output

No response

Validations

michalkleiner commented 4 months ago

This can happen if the previous visit is removed e.g. using the GDPR tools or some other way. The visit marked as returning will stay marked as returning even when the original first visit is removed (for whatever reason).

peterbo commented 4 months ago

Raw data deletion is set to > 1000 days and no GDPR tools deletion is used. Can there be any other case? We're using "fingerprint lookback window (14000 seconds) > session active window (1800 seconds)" recognition. A lot of fresh sessions are showing the "returning" symbol but only consist of one visit.

sgiehl commented 4 months ago

Hey @peterbo. When you hover the returning visitor icon, there should be a tooltip showing how many visits the visitor had. Does that one also show 1 visit?

peterbo commented 4 months ago

Hi @sgiehl the icon tooltip shows 2 visits

sgiehl commented 4 months ago

Ok. But that means it at least found a previous visit when creating that visit 🤔 Are you able to find two visits for the same visitor id in the database? Wondering if there might be some weird reason for the visitorid to be changed, even though it should reuse the same from the previous visit...

peterbo commented 4 months ago

Hi @sgiehl I can find other visits for the (potentially) same visitor:

returning-visit1

returning-visit3

config_id & IP is the same, but the visitor_id has changed. Both visitor profiles only show 1 visit.

sgiehl commented 3 months ago

Hm. That's still really strange. Even if it would match the visitor by config id it should actually reuse the visitor id. Can you see any coincidences when that happens. Like do all of them have a campaign detected or similar?

peterbo commented 3 months ago

Hi @sgiehl - this happens also without campaign referrers:

visitor-returning1 visitor-returning2 visitor-returning3

sgiehl commented 2 months ago

I think I've found a possible reason for this. There are certain cases where a visitor id might change during a visit. If that happens the visit might be sort of cut off from previous visits. So the new visitorid has only the current visit, but as the visitor previously had other visits (now with another visitorid), the visit is still marked as returning.