Timezone bug? Visits being reported on the correct hour #4380

jasonbukowski opened this Issue Dec 13, 2013 · 13 comments

3 participants


There is a bug in Piwik 2, that appeared at before 2.0-b11, that results in the report data not being displayed at certain times. The data is tracked correctly. Somehow Piwik reports and API return no data between certain hours.

Visitors in Real Time report reports are NOT affected by this.

This maybe points to a problem in archiving or some code related to archiving. Let's find out and try to release a new version 2.0.2.
Keywords: visits timezone wrong date

Piwik Open Source Analytics member

When you say "report is showing that the visit occurred at 22:00 on December 12th" what do you mean exactly, where is this displayed?

Maybe you could post a screenshot that shows data displayed with the wrong time, it would help me, cheers

Piwik Open Source Analytics member
My sites are running in the New York timezone, which is -5 hours from UTC.
At 19:00 New York time, on a Thursday for example, it is 00:00 Friday UTC.
Visits between 19:00 and 23:59 NY time on a Thursday are being tracked/reported as visits between 19:00 and 23:59 Friday.
Simply put, the times of the visits are always correct when looking at the servertime reports, but if it is the next day in UTC time at the time of visit, the visit is being reported as happening the next day, which is still in the future for NY time.
On December 12th all my visits after 19:00 we're being reported as visits on December 13th, even though it was still the 12th.
The time is always being reported correctly, but if there is a difference in the website timezone's current day and UTC's current day, the visit is incorrectly being attributed to the UTC current day.

In forum: http://forum.piwik.org/read.php?2,108213

Thanks for the report


Although I'm only using the API, I was able to get the UI to display some pages that highlight this problem.

These screenshots were taken on December 13th, 2013 at 21:30 NY Time, the same timezone the websites are configured for.

I modified the URLs so that they would display data for December 14th (as highlighted in the URL bar)


Above, you will see that visits are being reported for December 14th, 19:00 - 21:00.


Above, you will see in the visit chart that there have been 36 visits in total recorded for December 14th, 2013.

It is still December 13th, 2013 in my timezone and in the website's timezone.

Piwik Open Source Analytics member
Piwik Open Source Analytics member

Maybe this is the same report as: http://forum.piwik.org/read.php?2,108410

NOTE: many users experience this bug!

Piwik Open Source Analytics member

report from email:

Version 2.0 has a serious bug in it in regards to time zones.  I ended up installing a fresh copy of it yesterday.Today it recorded activity okay up until a certain point.  Then all the widgets stopped adding visits info.  Upon further investigation the visits after a certain time of day are being counted as activity on the next day, even though we aren't on the next day yet.  I am on New York time. 
Piwik Open Source Analytics member

Initial ticket report below:

I have a website configured to be on the New York timezone. The server time report (retrieved from getVisitInformationPerServerTime API method) correctly returns visits at the appropriate time for my timezone in most cases, with a very large exception. In cases where it is near the end of the day in NY, but it is the following day UTC, the report shows the visit for the correct hour in the NY timezone, but displays it for that hour on the following day.

For example, at 22:00 December 11th NY Time, which would be 03:00 December 12th UTC, the server time report is showing that the visit occurred at 22:00 on December 12th. It seems the time is being adjusted appropriately, but the date itself is not.

This is equally affecting standard visit report retrieved from the API as well, with visits late in the day being recorded as visits for the following day. In the case of the site configuration mentioned above, visits I am receiving after 19:00 NY time (00:00 UTC) are being reported as visits from one day in the future, from the NY perspective.

Visitors in Real Time report in NOT affected by this.

Piwik Open Source Analytics member

from forum:

I just updated to 2.0.1 and it's still the same. No data for Previous 30 days (not including today), but there's data for Last 30 days (including today).

Piwik Open Source Analytics member

In 2f3bb08: Fixes #4380, make sure site's timezone is applied when selecting log data to aggregate. Includes integration test + doc fixes to Date function.

Piwik Open Source Analytics member

To all users having this issue:

Can you please apply following change. Open file core/DataAccess/LogAggregator.php
replace at line 149

$this->dateStart = $params->getPeriod()->getDateStart();
        $this->dateEnd = $params->getPeriod()->getDateEnd();


$this->dateStart = $params->getDateStart();
        $this->dateEnd = $params->getDateEnd();

Then either delete the piwik_archive_*_2013_12 , or wait up to 24 hours to see if the bug is fixed.

Does it fix it?

Piwik Open Source Analytics member

Bug fix was confirmed in the forums by three users. Great find @capedfuzz!

@jasonbukowski jasonbukowski added this to the 2.0.2 - Piwik 2.0.2 milestone Jul 8, 2014
@sabl0r sabl0r pushed a commit to sabl0r/piwik that referenced this issue Sep 23, 2014
@diosmosis diosmosis Fixes #4380, make sure site's timezone is applied when selecting log …
…data to aggregate. Includes integration test + doc fixes to Date function.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment