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

Average time spent on each page is incorrect #18270

Closed
mkassir95 opened this issue Nov 3, 2021 · 7 comments · Fixed by #18294
Closed

Average time spent on each page is incorrect #18270

mkassir95 opened this issue Nov 3, 2021 · 7 comments · Fixed by #18294
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@mkassir95
Copy link

I am tracking events and pages , matomo is calacating the time spent on each page as the difference between the last event done on the page and the next page view and not the difference between the two page views. How to solve this

@mkassir95 mkassir95 added the Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. label Nov 3, 2021
@peterbo
Copy link
Contributor

peterbo commented Nov 11, 2021

+1 - Time on page is currently calculated incorrectly on pages that trigger events or site searches (and probably others like outlinks). The time on page timer should only be stopped by another pageview.

time on page1

Time on page should be 14s here, because the second pageview happened 14s after the first one. But it is only 1s, because the timer is stopped by (in this case) the site search. The exact same behaviour happens with events.

@sgiehl
Copy link
Member

sgiehl commented Nov 11, 2021

That indeed sounds like a bug. @peterbo Are you able to say if that only has effect on the visits log, or is that also the case for the overall time one page calculation you can see in the pages reports?

@sgiehl sgiehl added Bug For errors / faults / flaws / inconsistencies etc. and removed Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. labels Nov 11, 2021
@sgiehl
Copy link
Member

sgiehl commented Nov 11, 2021

@peterbo Had a quick look at the visits log implementation. This might possibly fix it: https://github.com/matomo-org/matomo/compare/vlogtimeonpage
But I'm currently not able to finish that PR by adding some tests as my time is quite limited. Will try to finish that another time if no one else is able to pick that up till then.

@peterbo
Copy link
Contributor

peterbo commented Nov 11, 2021

That indeed sounds like a bug. @peterbo Are you able to say if that only has effect on the visits log, or is that also the case for the overall time one page calculation you can see in the pages reports?

That's a good question. It definitely reflects the wrong behaviour in the link_visit_action table (time_spent_ref_action), but perhaps the archiver uses another logic. I'll check later in a smaller instance and replicate this.

@peterbo
Copy link
Contributor

peterbo commented Nov 11, 2021

That indeed sounds like a bug. @peterbo Are you able to say if that only has effect on the visits log, or is that also the case for the overall time one page calculation you can see in the pages reports?

Luckily, it looks like it doesn't affect the calculation of the pages report "avg. time on page", but just the display within the Visitor log:

time_on_page2

@tsteur
Copy link
Member

tsteur commented Nov 11, 2021

Is this a duplicate of #9198 ?

@sgiehl
Copy link
Member

sgiehl commented Nov 11, 2021

@tsteur it's not a duplicate. #9198 is about the average metric, which is also wrong for a similar reason. This is about the time on page displayed is the visits log tooltips. The linked PR aims to fix that, even though it's not yet complete.

@sgiehl sgiehl added this to the 4.7.0 milestone Nov 26, 2021
@sgiehl sgiehl changed the title Average time spent on each page Average time spent on each page is incorrect Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants