Opened 6 years ago

Closed 3 years ago

#373 closed Bug (fixed)

Period reports must always or never include today's statistics

Reported by: matt Owned by: matt
Priority: major Milestone: Piwik 1.3
Component: Core Keywords:
Cc: x.meglio@… Sensitive: no

Description (last modified by matt)

Reports for weeks, months and year do not include the most recent "today" data. Reports for weeks/month/year are only processed once per day, therefore are not 'real time' as such. This was done for performance optimization in the first place.

more info from Anton: I researched on this problem little more and I found real bug in the logic. Follow instructions below and you will see where the problem is:

  1. Setup always_archive_data = false
  1. Create new html page, add it as new site to Piwik and put JavaScript code to the page. DO NOT query for statistics for this site (actually it is only 1 page)
  1. Make some visits from different browsers and/or machines.
  1. Query for last day, then last week, month and for last year. You will see the same numbers for visits, actions etc. We are expecting weekly, monthly and yearly statistics do not include today's statistics. BUG.

Actually Piwik can't find archive built for last week, and it build it including today's visits. So Piwik does not follow the same logic. See next...

  1. Now you have all archives built. Try to make some more visits and query for last day, week, month and year again. You will see new visits in the last day, but you will not see them in last month and year, but you will see it for last week! So it is totally confusing. Now Piwik does not include new visits from today (just like you said in your previous message). But it does it if no archives built in the past.

P.S. If you set always_archive_data = true and ask Piwik for visits for last day, week, month and year again - it will be ok including all today's visits.

So Piwik does not follow your logic described in the previous letter. It seems that the logic is that Piwik checks whether archive is built already and simply does not rebuild it.

It must NEVER include today's statistics... or ALWAYS include today's statistics. We can also contemplate a config file boolean setting include_today_statistics_in_period_archives

Change History (15)

comment:1 Changed 6 years ago by matt (mattab)

  • Milestone changed from DigitalVibes to RobotRock

Could replicate on this piwik server red-sea and other pages...

comment:2 Changed 5 years ago by vipsoft (robocoder)

  • Milestone changed from RobotRock to DigitalVibes

comment:3 Changed 5 years ago by matt (mattab)

  • Description modified (diff)

comment:4 Changed 5 years ago by albass

comment:5 Changed 5 years ago by domtop

comment:6 Changed 5 years ago by koteiko

comment:7 Changed 5 years ago by koteiko

comment:8 Changed 4 years ago by matt (mattab)

  • Description modified (diff)
  • Sensitive unset

comment:9 Changed 4 years ago by matt (mattab)

  • Milestone changed from 0 - Piwik 0.6.4 to Features requests - after Piwik 1.0

comment:10 Changed 4 years ago by matt (mattab)

  • Priority changed from major to low

comment:11 Changed 4 years ago by WaKKa

...so? Is it possible correct this bur or not ? I don't understand if it is "better" with this problem

comment:12 Changed 3 years ago by matt (mattab)

It is not 'better', just more performant as monthly/weekly archives are processed only once per day.

comment:13 Changed 3 years ago by matt (mattab)

There are so many messages of confusion about this in the forums over the months. It could be good to at least let the users know, what exactly is included in the report (even if we don't implement the full ticket yet).

the message is displayed when viewing "this current" week, month or year. It could say "This report does not include data between 4AM and 6:30pm today. "

comment:14 Changed 3 years ago by matt (mattab)

  • Milestone changed from Feature requests to 1.3 - Piwik 1.3
  • Owner set to matt
  • Priority changed from low to major

OK about time to tackle this one

comment:15 Changed 3 years ago by matt (mattab)

  • Resolution set to fixed
  • Status changed from new to closed

(In [4341]) Fixes #373 it was really not that hard, I wonder why I postponed it for 2 years...
so now, any report that "contain" today, current week/month or date range containing today, will be processed every N seconds, N being the timeout set in General Settings
however if a report is requested for 'current month' eg., and archiving via browser is disabled, we will select 'any current month' archive that was processed today. So we might display out of date reports, ie. the oldest behavior, if archiving is disabled and crontab doesn't run as often as the timeout set in GEneral settings

Note: See TracTickets for help on using tickets.