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

Fix time on page calculation in visits log #18294

Merged
merged 5 commits into from Nov 26, 2021
Merged

Fix time on page calculation in visits log #18294

merged 5 commits into from Nov 26, 2021

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Nov 11, 2021

Description:

This change would actually remove the time on page for all actions other than pageviews. For pageviews the time on page would be summed up till the next pageview.

This is an approach to fix #18270

Did the changes in a couple of minutes while checking for a possible reason. To finish this some manual testing and updating/adding tests would be needed.

@tsteur If this is something that should be worked on further, feel free to assign the PR to a milestone and I will resume the work then.

Review

@sgiehl sgiehl added the Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. label Nov 11, 2021
@tsteur
Copy link
Member

tsteur commented Nov 11, 2021

@sgiehl how much more time would it take to finish it? I guess originally the idea was to eventually fix the root cause of #9198 which then would fix this as well. As this might take a while until we work on #9198 could maybe get this done now if it's real quick.

There's a bit of a problem that then eg people who aggregate the page view time manually will find it's different to the reported average time. But we could probably ignore this.

@sgiehl
Copy link
Member Author

sgiehl commented Nov 12, 2021

@tsteur I think the code in the PR should actually work. It would remove the "time on page" metric for all non page view actions in the visits log API. The time on page views should be summed up.
To ensure that really works as expected I would need to build a simple system test case that tracks multiple different actions and if that works also adjust the now failing tests. Guess that would be doable in a couple of hours.

@tsteur
Copy link
Member

tsteur commented Nov 14, 2021

@sgiehl this already changes quite a lot of system tests so maybe no new system test would need to be written ? https://app.travis-ci.com/github/matomo-org/matomo/jobs/547727804

@sgiehl
Copy link
Member Author

sgiehl commented Nov 18, 2021

I'd rather like to write a very simple new test that tracks some different actions and validate if the resulting number are correct and then simply update the expected results of all other tests assuming they are correct.
Could also try to do that with the existing tests, but might be more effort to look through the fixtures and check which results would be expected, as we often don't turn time forward when tracking additional actions.

@sgiehl sgiehl force-pushed the vlogtimeonpage branch 3 times, most recently from 3248bd5 to 7b9337c Compare November 19, 2021 14:45
@sgiehl
Copy link
Member Author

sgiehl commented Nov 23, 2021

This PR should be ready for a first review. The time on page should now only be calculated for page views. For all other action types the timeSpent and timeSpentRef columns are removed. If a visit doesn't contain a page view, there will actually be no action that contains a timeSpent

Some System tests of submodule plugins are still failing, but those can be updated once this one would be ready to merge.

@sgiehl sgiehl marked this pull request as ready for review November 23, 2021 16:32
@sgiehl sgiehl added Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. and removed Pull Request WIP Indicates the current pull request is still work in progress and not ready yet for a review. labels Nov 23, 2021
@sgiehl
Copy link
Member Author

sgiehl commented Nov 24, 2021

@tsteur shall we merge this one for 4.7 then?

@tsteur
Copy link
Member

tsteur commented Nov 24, 2021

OK sounds good

@sgiehl sgiehl added this to the 4.7.0 milestone Nov 25, 2021
@sgiehl sgiehl merged commit 7f1ba09 into 4.x-dev Nov 26, 2021
@sgiehl sgiehl deleted the vlogtimeonpage branch November 26, 2021 14:35
@sgiehl
Copy link
Member Author

sgiehl commented Nov 26, 2021

@AltamashShaikh This most likely will break the tests for various plugins. The time spent in visit details may change in various tests. Those can be simply updated, if there are no other changes.

@AltamashShaikh
Copy link
Contributor

Okay Thanks,
Will keep this in mind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Average time spent on each page is incorrect
3 participants