Live stats from midnight, not continuum



As a pretty new user of Piwik I am kinda confused by the way in which data is presented in the live widgets. That is, in the past 10 years in ALL previous analitycs i have used, with or without a live component, the numbers for today were ever increasing. That is, for example, at a glance:

At 14:34 I had 150 visitors and 424 pageviews.
At 15:56 I had 174 vistors and 567 pageviews.
At 21:44 I had 380 visitors and 712 pageviews.

And so forth, you get the point, the numbers only kept growing. This way I was having a clear picture of my sites traffic because i had a clear reference in the past. On the other hand piwik, in widgets, both simplelastvisitcount and live lastvisits dont work this way, with a reset to 0 at midnight. Leaving computer now with 159 visitors (during last 24 hours), returning 40 minutes later and I have 110 visitors. This is not a helpful information, at least not for me. You would expect todays visitors to stay the same or grow, not to decrease.

I did however find a widget that is doing this the correct way, that is visitors summary, which counts visits and pageviews starting with midnight. But sadly only works by manual refreshing. I removed everything except for visits and pageviews to load instantly, and manual refresh it, as a temporary solution. I tried so hard in past week or so to make “today” meaning “starting from midnight until now” in a live widget. I am not php literate, but i tried like a monkey not knowing very well what he was doing to get the function working… No success kid here, unfortunately . I am thinking that if Piwik can count easily in real-time with auto-refreshing from 4 pm today until 4 pm yesterday without the need to access the archives like the visitors summary does, it should be able to count from 4 pm today until only 0:00 am today, right? It is less of a time span, not more.

Any ideas? Or is it there a simple function that i can replace in the live plugin php or templates to make this happen? I can`t believe I am the only one wanting live stats starting with “today”, not a continuum today-yesterday. I dont think it is something that has to do with getting used to it. It is just not natural to me. Any help or indication would be appreciated.

(Matthieu Aubry) #2

The number of visitors over the last 24 hours is useful number and is not meant to be used like you would like to. instead you can use the Visits summary widget(s) which give the number of visits during the day (if you select today in the calendar)


hence the problem, it is not live…look at every other real time analytics,eg woopra, clicky,etc… live stats for “today” is for today, starting with midnight, not last 24 hours continuum… well, i guess my suggestion is denied :frowning:


for those wishing like me to have LIVE stats and counters reset at midnight and then go only upwards until next midnight, i discovered how to do it:

in plugins/live/controller.php, in private function setCounters($view) change this:

$today = API::getInstance()->getCounters($this->idSite, $lastMinutes=( time() - strtotime(‘midnight, GMT+2’))/60 , $segment);

this is around line 129-130 or so…you might need to change the GMT+2, or just leave it like this, its working either way just the “reset” occurs at different time.

(Matthieu Aubry) #5

Ok I now understand your request, thanks for insisting. I understand that you would like is a way to have the dashboard automatically refresh, when the date selected is “Today”. When we know that today is used we could automatically refresh the widgets every 1 min or 1 hour (depending on the timeout set in Settings > General Settings)


I understand that you would like is a way to have the dashboard automatically refresh, when the date selected is “Today”[/quote]

if you talk about Visits Overview widget and making it auto-refresh, yeah, that could be a very cool solution too, especially since that widget has many more info than just the pageviews and visits…it`s true that performance-wise this can be tricky because it is one of the slowest widget to load, if not the slowest because of those 10 or so graphs that needs to generate…

but meanwhile, with the modified $today within the controller.php, the “last24 hours” is turned into “today up until now”… the visits and pageviews are only going upwards during the day, until the next reset which will occur at midnight and so on… i have a quick way to see today`s traffic in real-time, autorefreshing, just the way i am used to :slight_smile:

on the other hand, maybe i am the only crazy guy unwilling to change and embrace this “last 24 hours continuum” which for me is confusing for reasons i explained in the first post… I might very well be a minority and I am sure you guys have more important and useful tickets to deal with… that`s why i posted my finding here, to maybe help the few others that might be interested in this matter…

thanks for your time!