@bx80 opened this Pull Request on October 5th 2021 Contributor


Fixes #6784

This PR changes multi site evolution metrics to calculate proportionally to the percent of the current period which is complete.

For example, if there were 1,000 site visits last week, the current time is midnight on Monday and there have been 150 visits so far this week, then the All Websites visits evolution percent would have shown as a red -85% because 150 visits is a big drop from 1,000. (This Week Visits - Last Week Visits) / (Last Week Visits)

However this in an unfair comparison as the current week is incomplete. If the remaining days of the week continue to at 150 visits then the current week will be an improvement over the previous week.

Since only ~14% of the current week has elapsed a better comparison would be 14% of the previous week total visits vs the current visits in this week, this results in a green 5% evolution percent. (This Week Visits - (Last Week Visits Percent of Period Complete) / (Last Week Visits Percent of Period Complete)


@mattab commented on October 6th 2021 Member

@mattab can you confirm we also want to adjust the percentage when eg one month has 30 days and the other 31 and then adjust the percentage accordingly? Or should this happen only when the currently viewed period includes today?

This "proportional-adjustement" logic should happen only when currently viewed period includes today.

@bx80 commented on October 7th 2021 Contributor

I've added a tooltip to explain when the comparison is proportional.

If the current period doesn't contain the current date/time then the proportional adjustment will not be applied (ratio = 1, do nothing)

Also added a unit test which feeds some fixed date empty datatables to the ratio calculation code to check that the expected ratio is returned.

@mattab commented on October 7th 2021 Member

Q: would make the tooltip maybe more descriptive if possible to remove any possible confusion in how we came up the with number, for example this below (or a better text):

The currently selected time period is 53% complete.
When the previous period was also 53% complete, there would have been an estimated 5,300 visits (out of a total of 10,000 visits in the previous period).
12,925 visits in today|this week|this month compared to 5,300 visits in the previous period (2021-09-07.) Evolution: +x%

(note: the last line is from the existing tooltip used in Acquisition > Overview report)

@tsteur commented on October 7th 2021 Member

@mattab yes it would be, and thought about it, but considering 80/20 it be likely good enough to just have something generic

@bx80 commented on October 7th 2021 Contributor

It was quick to add some more detail to the tool tip, so I went ahead and did it, hope that's okay!

@github-actions[bot] commented on October 25th 2021 Contributor

This issue is in "needs review" but there has been no activity for 7 days. ping @matomo-org/core-reviewers

@bx80 commented on October 26th 2021 Contributor

@tsteur @sgiehl I've removed metadata from the API output and fixed the broken tests, this PR should now be ready for review again.

@tsteur commented on October 26th 2021 Member

Awesome 👍 @sgiehl can you maybe have a last look?

This Pull Request was closed on November 15th 2021
Powered by GitHub Issue Mirror