-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for editing the site timezone #5476
Comments
A better solution would be to store all dates/time in GMT, and process the dates relative to the “Local time” set by the Piwik Super User. |
From #479, a timezone configuration mismatch between php and mysql can cause a lag in dashboard reporting. Proposed change in comment 2 should fix this problem. |
potential thing to fix in the code: all timestamp may have to be Mysql-based rather than php-based (or the opposite, to spec) in case the webserver and mysql server are on different times/timezones. For example, in core/ArchiveProcessing.php line 250: ``````
|
(In [1959]) refs #5476 - handle timezone mismatch more gracefully |
Some decisions
|
feedback from Anthon
|
(In [2006]) Refs #5476
|
To do in this ticket Regressions to fix:
More testing
Also, code review and more testing very appreciated :) this is rather large change and I'm sure there are still some bugs. |
Also
|
also
|
|
|
Hi, I have made an update to the latest svn. After update the Live plugin shows me the incorrect UTC. I have set the correct timezone global and on site unfortunately without any changes. Is it just me, or is it a little bug? cheers |
(In [2058]) Refs #5476
|
(In [2066]) refs #5476 - sort cities within each continent |
(In [2067]) Refs #5476
|
|
|
(In [2078]) Refs #5476
|
(In [2079]) Refs #5476
|
(In [2081]) Refs #5476
|
(In [2082]) Refs #5476
|
New installation of 0.6-rc1. Visiting the Dashboard for the first time (no visits yet), I see the following errors in the widgets. In the Last Visits Graph:
In other widgets:
My timezone is America/Toronto (currently UTC-4). The current time was 17:12 PM (EDT). ts_archived on the blobs was 2010-04-10 21:12:55. |
Scratch my last comment. My test env ignored the logging changes in [2078]. |
(In [2091]) Refs #5476
|
(In [2095]) Refs #5476 fix typo |
php 5.1.6 user reported getting a notice: see: http://us3.php.net/manual/en/language.oop5.magic.php#language.oop5.magic.tostring |
(In [2124]) Refs #5476 regression admin users can access Websites tab |
(In [2126]) Refs #5476 Fixing the Visits by server time report to report times in the website's timezone |
Closing ticket as all outstanding issues are now fixed. Please open new tickets for specific issues related to timezones. |
A server can be located in the US but the website being used by people from WEST EUROPE. Piwik user wants to see his reports in the WEST EUROPE timezone.
- add a new setting Timezone in the admin UI
- the timezone is website based – each website can have a different timezone set. All users looking at stats for a given website will see the data in the website’ specified timezone.
- (optional) a “default timezone” can be set by the Super User, that would be used to define the timezone by default when creating new websites. When creating new websites, the timezone dropdown would be pre-selected with this “default timezone” but users could still change it. If the Super User doesn’t define this default timezone, it falls back to the server timezone (current behavior).
- timezone being an attribute of the website, the SitesManager API would have to slightly updated to reflect the new parameter. We should keep backward compatibility if possible. The timezone wuold for example become the last parameter of`
addSite( $siteName, $urls, $timezone )`} and would be optional. If not specified, the timezone would default to the general “default timezone” (see above).
- all dates and times must be stored in the DB in UTC. This means that in the various log_\* tables, any field that is DATE or DATETIME should be set with dates and datetimes that are based in UTC.
- currently in the Archiving process, a standard archiving query looks like:
```
SELECT name,
type,
count(distinct t1.idvisit) as nb_visits,
count(distinct visitor_idcookie) as nb_uniq_visitors,
count(*) as nb_hits
FROM (“.$archiveProcessing→logTable.” as t1
LEFT JOIN “.$archiveProcessing→logVisitActionTable.” as t2 USING (idvisit))
LEFT JOIN “.$archiveProcessing→logActionTable.” as t3 USING (idaction)
WHERE visit_server_date = ?
AND idsite = ?
GROUP BY t3.idaction
ORDER BY nb_hits DESC
```
You can see that the WHERE is currently on the visit_server_date field which is a DATE only, which is a problem for selecting records that are in a given timezone.
- for queries working on the log_visit table, the WHERE should probably be on visit_first_action_time instead. The INDEX on the log_visit table should be updated to include visit_first_action_time instead of visit_server_date.
- for queries working on the log_conversion table, the WHERE should probably be on server_time instead of visit_server_date. The INDEX on the log_conversion table should also be updated to include this field.
- I believe mysql is clever and is able to use the INDEX on a DATETIME field for a range query. We should double check that this is the case :)
- After these changes to the tracking tables, it will be possible to update the few queries doing the archiving and instead of using visit_server_date, make them use the right UTC time fields, and select records that are between the website specified timezone.
For example, the selected date (June 25 2009) to the website timezone:
```
visit_server_date = ‘2009-06-25’
```
would become for example
```
visit_first_action_time >= ‘2009-06-24 16:00:00’
AND visit_first_action_time <= ‘2009-06-24 15:59:59’
```
- this conversion of the date object would probably be done around Archive::build() – and the few archiving queries would have to be updated
- when changing the timezone setting for a given website, all previous stats are not re-processed and will still show in the previously selected timezone. The new timezone is applied only to future reports. Note: this is how a lot of software work (including GA, adwords, etc.)
The text was updated successfully, but these errors were encountered: