View goals by server time


I think there is something wrong with the table “View goals by server time” in my Piwik 1.5.
Let me explain why I think so:

The date range in piwik is set to today. I am located in Germany (GMT+2) and it is a couple of minutes before 11pm.
In the table “View goals by server time” the first column is the time, and though it’s still before 11pm server time, there is already an entry for 11pm. The second column shows the “visits” and for the row 11pm there is an entry “-” (this makes sense, because there can’t be any visit yet). However, in this column “11pm” there are already goal conversions (This doesn’t make any sense, because 11pm is in the future)

Additionally, a new conversion happening a couple of minutes before 11pm does not increase the value in the row “10pm” as I would expect, but in the row “8pm”. This can be explained by the fact, that 10pm in my timezone (GMT+2) is 8pm GMT.

Maybe the first can be explained with the second failure: probably the db-request is based on GMT time, whereas some of the php time-calculations expect the db-result to be already in GMT+2 format.

I hope you understand what I mean.
Best, DorianK

What timezone did you set for this website in Settings?

Timezone is set to “Europe/Berlin”.

I just took a look at the database. In the table “piwik_log_conversion” there is a column “server_time”. However, the data in the column is not the server time but the GMT/UTC time.

I tried to figure out, why this is.


	public function recordGoals($idSite, $visitorInformation, $visitCustomVariables, $action, $referrerTimestamp, $referrerUrl, $referrerCampaignName, $referrerCampaignKeyword)
		$location_country = isset($visitorInformation['location_country']) 
							? $visitorInformation['location_country'] 
							: Piwik_Common::getCountry( 
										$enableLanguageToCountryGuess = Piwik_Tracker_Config::getInstance()->Tracker['enable_language_to_country_guess'], $visitorInformation['location_ip'] 
		$location_continent = isset($visitorInformation['location_continent']) 
								? $visitorInformation['location_continent'] 
								: Piwik_Common::getContinent($location_country);

		$goal = array(
			'idvisit' 			=> $visitorInformation['idvisit'],
			'idsite' 			=> $idSite,
			'idvisitor' 		=> $visitorInformation['idvisitor'],
			[b]'server_time' 		=> Piwik_Tracker::getDatetimeFromTimestamp($visitorInformation['visit_last_action_time']),[/b]
			'location_country'  => $location_country,
			'location_continent'=> $location_continent,
			'visitor_returning' => $visitorInformation['visitor_returning'],
			'visitor_days_since_first' => $visitorInformation['visitor_days_since_first'],
			'visitor_days_since_order' => $visitorInformation['visitor_days_since_order'],
			'visitor_count_visits' => $visitorInformation['visitor_count_visits'],

In the piwik,php there is a line


So whenever you use “Piwik_Tracker::getDatetimeFromTimestamp($timestamp)” this will give you a result in GMT and not in server time.
I don’t know whether you want it this way.