Skip to content

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

@diosmosis

Description

@diosmosis

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

Metadata

Metadata

Assignees

Labels

c: PlatformFor Matomo platform changes that aren't impacting any of our APIs but improve the core itself.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions