matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.67k stars 2.62k forks source link

Email report error in setting specific period and scheduling #21044

Open RCPrato opened 1 year ago

RCPrato commented 1 year ago

I would a daily mail with “Pages” report of previous week. For example:

So i set “Email schedule” as “Daily” and “Report period” as “week” because i imagined that for “week” Matomo meant the week that ends on the day that sends the email. But i was wrong…

On report sent by mail, “week” start on the day the mail is sent. So:

It doesn’t make sense… unless Matomo is a seer 🙂

sgiehl commented 1 year ago

Hi @RCPrato. Thanks for creating this issue. As far as I know this was actually implemented on purpose this way. But I agree that it should be at least clear in the UI, which period of data you would receive when, after selecting the options. Maybe it would be helpful to have a small note in the report list for each report that says something like Next report will be sent on xx.xx.xxxx containing the data from xx.xx.xxxx to xx.xx.xxxx or similar.

RCPrato commented 1 year ago

Hi @sgiehl i think is more than a UI problem.

Last report, in date 18 july, say:

"Hello, Please find below your day report for [Name Measurables]. [Name custom report] Date range: week July 17 – 23, 2023 Sent from https://matomo....."

I believe it actually sends the data for the week "July 17-23" but since it sends it on July 18, it actually only sends the data for July 17 and 18. Clearly such a setup is useless.

Stan-vw commented 1 year ago

I've had this one on my "to investigate" list for a while, as I played around with scheduled reports for a bit and it wasn't giving me data every week/month. I've had reports that indeed only showed 1 day and I've had reports that showed data for the entire week, and I haven't figured out properly why the difference happens.

I would definitely say Matomo shouldn't provide "future dates" in scheduled reports (as future data is obviously not available). As I asked around, I learned:

@RCPrato Could you:

  1. check if your reports are in line with the above items, e.g. that your reports are indeed useful if they are sent on a Sunday? (so it contains 7 days of data)
  2. let me know if there's a particular need for weekly reports that show data for other 7 day periods (e.g. Wednesdays to Tuesdays)
Stan-vw commented 1 year ago

Update: I just received a report (frequency=daily) with weekly data, see screenshot below. It shows that it's sent on 6 September and shows data for "4-10 September", which equals data for 4-5 September (and perhaps some data from 6 September?)

Now that I'm looking at it, I'm in 2 minds about it:

  1. This report should be showing me the previous 7 days so that I can see 7 days of data.
  2. This report might be used on a daily basis by some people to see how their week is progressing.

Overall, I think the first logic is the right one (i.e. I agree with the original description of the issue), but it would be helpful to get some feedback if there's any users that prefer the second logic (and for which reason).

image

@sgiehl for my understanding, what are the "costs" of implementing this to show "last 7 days"? E.g. is the archiving for a custom range period prior to sending a large CPU performance drag, does it affect storage used per instance, is it easy/difficult to implement, ...?

sgiehl commented 1 year ago

@Stan-vw Adding a "last 7 days" to those reports should be possible, but would require a couple of adjustments. Currently the reports only store a period (day, week, month, year), this would need to be extended for additional options. Calculating custom range periods in general can always cause issues on bigger instances, but that's actually the same as choosing them in the period selector. So unless range periods are disabled on purpose it should be safe to provide such a feature.

heurteph-ei commented 1 year ago

When custom ranges are disabled, this should provide data from previous full week, I think...

Stan-vw commented 1 year ago

Having looked at this again, I’m noticing that in the helptext (see attached) we’ve looked at the logic “sending reports for a single day once a week” but not “sending reports for a week/month every day”, which is probably why this use case isn't working correctly at the moment.

As you can make a daily scheduled report with weekly data, I think @sgiehl's suggestion to make it "last 7 days" through custom range periods sounds reasonable. While we’re at it, we can probably do it for Month and Year as well.

I’m slightly concerned if this will create performance issues or carry significant cost. Any thoughts on this?

Screen Shot 2023-09-15 at 3 32 13 PM

heurteph-ei commented 1 year ago

In my case, I disabled custom date ranges, then 7 previous days will only have meaning on Monday... If I want my report is sent on Wednesday... What happens?

MatomoForumNotifications commented 11 months ago

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/email-report-get-statistics-since-the-beginning-of-the-current-year/53672/2