Open 9joshua opened 4 months ago
Looking at the code this can be easily explained. We storing a visit counter with the visits. So if a visitor has three visits, the first visit has stored a 1, the second a 2, ...
The segment currently directly selects by this column. So if you are looking for equals 1
, it will select the first visit of all visitors.
So this segment is kind of broken by design. It might return correct data when looking for e.g. greater than
, but everything else might always include other visitors.
Another customer set up a segment expecting "number of visits" "at most" "1" to return only one-time visitors.
Trying to help a customer around this issue, but in Matomo there is no way to segment visits for visitors who only visited the site once. This is important data for marketers and others wanting to know the behaviour of one-time visitors.
The dimension as it is should read 'visit number' as the dimension only pulls data for visit # 2 when this is set to 2 for example, and is not capable of considering other future visits.
Part of the issue is that Matomo does not have visitor-scoped dimensions. Data is rather grouped by visit, leaving the relationship between visits somewhat of a mystery. I have proposed having visitor-scoped custom dimensions. Just as the profilable
dimension is a built-in visit-scoped dimension, 'number of visits' could be a built-in visitor-scoped dimension. There are many other potential uses for this.
What happened?
Segmentation reports for
Number of Visits = 1
include visitors with more than one visit. Here the number of Unique Visitors and Visits metrics should be equivalent...Searching the Visits Log shows some visitors who had 2 visits...
This issue also appears to affect Custom Reports which would be expected as the RAW data (as shown in the Visits Log) does not properly apply the number of visits condition.
What should happen?
Segmenting reports where the number of visits =1 should omit all visitors with more than 1 visit.
How can this be reproduced?
Matomo version
5.0.3
PHP version
8.1
Server operating system
Linux
What browsers are you seeing the problem on?
Chrome
Computer operating system
Ubuntu
Relevant log output
No response
Validations