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

Change "days since last ..." dimensions to save second duration instead of days and compute in PHP #14094

Closed
diosmosis opened this issue Feb 13, 2019 · 3 comments · Fixed by #15774
Assignees
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself.
Milestone

Comments

@diosmosis
Copy link
Member

diosmosis commented Feb 13, 2019

Saving days means cutting off the time of day, which makes the information less accurate. This prevents using, eg, visitor_days_since_first to find the exact time of a visitor's first visit.

Changing this would mean updating every row in the log table so we should likely do it in Matomo 4.

When changing this we can also get rid of the _idts query parameter in the tracker. It is possible to compute this in PHP without ever having to issue a SQL query.

After we search for an existing visitor we would:

  1. if new visitor, set time_since_last_visit = 0
  2. if existing visitor, set time_since_last_visit = last_visit.time_since_first_visit + (this_visit.visit_first_action_time - last_visit.visit_last_action_time)

This would allow computing this value for every type of tracking.

Refs #14125

@diosmosis diosmosis added this to the 4.0.0 milestone Feb 13, 2019
@diosmosis diosmosis changed the title Change "days since last ..." dimensions to save timestamps/durations instead of days Change "days since last ..." dimensions to save second duration instead of days and compute in PHP Nov 15, 2019
@diosmosis
Copy link
Member Author

This will also require a change to cohorts.

@mattab
Copy link
Member

mattab commented Feb 20, 2020

@diosmosis

Is this needed/valuable for Cohorts only, or are there more benefits to changing the field?

Changing this would mean updating every row in the log table so we should likely do it in Matomo

Probably we could skip the "update every row" and leave the old data as-is, and only insert the new data with the more accurate info.

@mattab mattab added the c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. label Feb 20, 2020
@diosmosis
Copy link
Member Author

Is this needed/valuable for Cohorts only, or are there more benefits to changing the field?

@mattab It allows Cohorts to be used w/ log analytics, server side analytics, makes the dimension more accurate (no bad values being sent), allows days since last dimension to be available w/ log analytics, and requires less data stored client side in a cookie.

Probably we could skip the "update every row" and leave the old data as-is, and only insert the new data with the more accurate info.

This is referencing having second durations instead of days so the setting is more accurate and doesn't result in slightly inaccurate reports in cohorts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants