@mattab opened this Issue on April 2nd 2019 Member

When loading the Visitor Profile for a Visitor that visited the website more than 100 times, then when loading more visits (clicking 10 times on "Load more visits" or so), the visit count end up showing a negative number #-3, when we expected visits count to go from <a href='/1'>#1</a> to <a href='/1'>#1</a>xx

URL to reproduce: https://demo.matomo.org/index.php?module=CoreHome&action=index&date=today&period=week&idSite=1&updated=4#?idSite=1&period=week&date=today&category=General_Visitors&subcategory=Live_VisitorLog&popover=visitorProfile$3Ab3b6d6a3249bc1fb&segment=visitCount%3E%3D200

Screenshot showing the problem:
negative visits

@sgiehl commented on July 15th 2019 Member

@mattab We are building up all the data summarized in the profile based on the last 100 visits (if not configured higher). So it might be correct to simply hide the "show more" link as soon as those 100 visits are shown

@mattab commented on August 9th 2019 Member

@sgiehl we can't really hide the "show more" link as it's important we give access to users to all their data that is stored and available in Matomo. When there are >= 100 visits, could we maybe issue a SQL query to count() how many total visits there are for this visitor, and use this value to write "Visit #xyz" instead of "Visit #100" ?

@sgiehl commented on August 10th 2019 Member

I'm not sure if it's a good idea to do that. The query for getting the visits is already quite slow for bigger databases. Adding another query that needs to check the whole table for matching visits might make it even worse.
It might also make the improvement by @tsteur in #14700 kind of useless for this case

@tsteur commented on August 10th 2019 Member

A count(*) is definitely not an option.

Would we be able to rename the visits when loading more like starting with #visit 200 or so etc once 100 more are loaded? I know it's not an ideal solution, but there likely won't be an ideal solution.

I suppose visitor_count_visits column doesn't help either?

@sgiehl commented on August 11th 2019 Member

If the value in visitor_count_visits always holds the total number of visits the user had, we could use it as number to start with. Even though it might be possible that the number of visits that can be shown might be lower if some visits have been deleted through data retention settings. But we maybe could show a message explaining that if the number differs...

@tsteur commented on August 11th 2019 Member

Actually, if I see this right, the visitor count comes from a param _idvc so this is not reliable :(

@sgiehl commented on August 12th 2019 Member

Then I guess the simplest solution would be to update the numbers of the already displayed visits? Eg when some loads another 10 visits after 100 already displayed, it would update the first visits displayed to 110 and so on, so the last one displayed again has number 1. Not an ideal solution, but still better to display negative numbers, right?

@tsteur commented on August 13th 2019 Member

Sounds good.
On the other side... what if we put more focus on the date which seems way more relevant than a random visit number? Do we even need this visit number? Looking it at it, I'm not finding it too valuable. The date be more valuable.

The very first visit should maybe say something like Most recent visit so it's clear it's not the very first visit but the last visit.

Powered by GitHub Issue Mirror