Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#1375 closed Bug (fixed)

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

Reported by: matt Owned by: peterb
Priority: normal Milestone: Piwik 1.1
Component: Core Keywords:
Cc: Sensitive: no

Description (last modified by peterb)

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.

Attachments (1)

piwik_live.png (34.8 KB) - added by matt 4 years ago.

Download all attachments as: .zip

Change History (13)

Changed 4 years ago by matt (mattab)

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

  • Description modified (diff)

comment:2 Changed 4 years ago by peterb (peterbo)

  • Owner set to peterb

comment:3 Changed 4 years ago by peterb (peterbo)

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

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

comment:4 Changed 4 years ago by peterb (peterbo)

  • Description modified (diff)
  • Milestone changed from Piwik 0.8 - A Web Analytics platform to 4 - Piwik 1.0 - Stable release
  • Priority changed from major to normal
  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:6 Changed 4 years ago by peterb (peterbo)

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?

comment:7 follow-up: Changed 4 years ago by peterb (peterbo)

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.

comment:8 in reply to: ↑ 7 Changed 4 years ago by Islander

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.

comment:9 Changed 4 years ago by vipsoft (robocoder)

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

(In [3024]) -fixes #1375

comment:10 Changed 4 years ago by vipsoft (robocoder)

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

comment:11 Changed 4 years ago by vipsoft (robocoder)

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

comment:12 Changed 3 years ago by vipsoft (robocoder)

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

Note: See TracTickets for help on using tickets.