Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Live! widget does not show correct number of visits for 'today' #1375

Closed
mattab opened this Issue · 10 comments

4 participants

Matthieu Aubry Peter Boehlke Anthon Pang Anonymous Piwik user
Matthieu Aubry
Owner

See attached screenshot.
I believe this is because the Live! plugin API function loadLastVisitorInLastXTimeFromDatabase is not using the website timezone to process the count of visits 'today'.

see bug report in http://forum.piwik.org/index.php?showtopic=9571

Seems not to be correctly fixed, Bug report from #1555:
Piwik 0.8 - When the setting of UTC is -5, the "Live Visitor!" daily summary stops counting at 19.00 hrs. and sets the values for visits and pageviews to 0 (afer 00.00 hrs. the count starts fresh for the new day and works fine until 19.00 hrs. of that day). All other widgets seem not to be having this problem.

Matthieu Aubry
Owner

Attachment:
piwik_live.png

Peter Boehlke
Collaborator

(In [2784]) fixes #1375, #1319

Peter Boehlke
Collaborator

limaeasy, i can't reproduce that. Is your system clock also set to UTC-5?
I tried the following test-case as this is the routine which is running in the Live!-Plugin:

$testDate = "2010-08-24 18:05:00";
$oDate = Piwik_Date::factory($testDate);
$oDate = $oDate->setTimezone("UTC-5");

echo $oDate->getDateStartUTC(); //echos 2010-08-24 05:00:00 in UTC as this is 00:00:00 in UTC-5
// ####

$testDate = "2010-08-24 19:05:00";
$oDate = Piwik_Date::factory($testDate);
$oDate = $oDate->setTimezone("UTC-5");

echo $oDate->getDateStartUTC(); //echos also 2010-08-24 05:00:00

So there should not be a difference between these two times; Can you help me to reproduce the problem?

Peter Boehlke
Collaborator

I was now able to reproduce the error:

If the Date Object is initalized this way:

$oDate = Piwik_Date::factory("now"); //server time 2010-08-24 21:01:00
$oDate = $oDate->setTimezone($sTimezone);
$oDate->getDateStartUTC(); //echos 2010-08-25 05:00:00 (not correct)

If the date object is initialized with a manual date:

$testDate = "2010-08-24 21:01:00";
$oDate = Piwik_Date::factory($testDate);
$oDate = $oDate->setTimezone($sTimezone);
$oDate->getDateStartUTC(); //echos 2010-08-24 05:00:00 (correct)

So it seems to be an error in the Date factory, we will have to investigate further.

UPDATE
This can only be reproduced, when the timezone in php.ini (date.timezone) is different from the timezone that is set for a given page (as expected).
If somebody has this problem, please check your server config and give feedback. I'm not yet sure if this is a bug.

Anonymous Piwik user

I've observed an issue which seems to be directly related to this. In fact I've been installing and reinstalling Piwik (latest release 0.9) the whole day because I though it didn't work, until I found out that changing the date range makes the data appear. Here the details.

I've Piwik installed on a server with the following date settings:

date/time support enabled

"Olson" Timezone Database Version 2010.3

Timezone Database internal

Default timezone Europe/Berlin

I've two pages added on Piwik for now, going to add a third one (located in the USA) tonight.

Page #1
date/time support enabled

Timezone Database Version 0.system

Timezone Database internal

Default timezone Europe/Berlin

All date ranges work (or so it seems) and show the total number of visits (only 1 for now)

Page #2
date/time support enabled

"Olson" Timezone Database Version 2010.3

Timezone Database internal

Default timezone Europe/Berlin

All date ranges work, except the "Week" range, it remains at 0, both in the dashboard and "all websites" view. But, and here it the curious thing, I've got Live Visitors Plugin enabled, and that one shows the visits for the present day, even when the other widgets show 0. Also, this webpage is on the same server than Piwik, so I am not sure if it has to do with different time zone settings. Turning off Live Visitors Plugin makes no difference, it still fails in the "Week" range.

I can do some further investigation once I get the third page online and post the results here if requested. Of course I can provide any other data as long as you tell me what exactly you need.

Anthon Pang
Collaborator

(In [3024]) -fixes #1375

Anthon Pang
Collaborator

(In [3026]) refs #1375 - similar fix for visitor log

Anthon Pang
Collaborator

(In [3246]) fixes #1458, refs #1375 - fix timezone issues

Anthon Pang
Collaborator

(In [3391]) refs #1375 - calculating "last X minutes" vs "last X days" now more similar in implementation

Matthieu Aubry mattab added this to the Piwik 1.1 milestone
Peter Boehlke peterbo was assigned by mattab
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.