diff options
Diffstat (limited to 'plugins/Live/Visitor.php')
-rw-r--r-- | plugins/Live/Visitor.php | 126 |
1 files changed, 83 insertions, 43 deletions
diff --git a/plugins/Live/Visitor.php b/plugins/Live/Visitor.php index 8887566009..1ac82ebddc 100644 --- a/plugins/Live/Visitor.php +++ b/plugins/Live/Visitor.php @@ -1,24 +1,22 @@ <?php /** * Piwik - Open source web analytics - * + * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later * @version $Id$ - * + * * @category Piwik_Plugins * @package Piwik_Live */ -// no direct access -defined('PIWIK_INCLUDE_PATH') or die; - /** * @see plugins/Referers/functions.php * @see plugins/UserCountry/functions.php * @see plugins/UserSettings/functions.php * @see plugins/Provider/functions.php */ + require_once PIWIK_INCLUDE_PATH . '/plugins/Referers/functions.php'; require_once PIWIK_INCLUDE_PATH . '/plugins/UserCountry/functions.php'; require_once PIWIK_INCLUDE_PATH . '/plugins/UserSettings/functions.php'; @@ -34,7 +32,7 @@ class Piwik_Live_Visitor { $this->details = $visitorRawData; } - + function getAllVisitorDetails() { return array( @@ -53,7 +51,7 @@ class Piwik_Live_Visitor 'visitLengthPretty' => $this->getVisitLengthPretty(), 'firstActionTimestamp' => $this->getTimestampFirstAction(), 'lastActionTimestamp' => $this->getTimestampLastAction(), - + 'refererType' => $this->getRefererType(), 'refererName' => $this->getRefererTypeName(), 'keywords' => $this->getKeywords(), @@ -61,7 +59,7 @@ class Piwik_Live_Visitor 'refererName' => $this->getRefererName(), 'searchEngineUrl' => $this->getSearchEngineUrl(), 'searchEngineIcon' => $this->getSearchEngineIcon(), - + 'operatingSystem' => $this->getOperatingSystem(), 'operatingSystemShortName' => $this->getOperatingSystemShortName(), 'operatingSystemIcon' => $this->getOperatingSystemIcon(), @@ -73,14 +71,18 @@ class Piwik_Live_Visitor 'resolution' => $this->getResolution(), 'screenIcon' => $this->getScreenTypeIcon(), 'plugins' => $this->getPlugins(), + 'lastActionDateTime' => $this->getDateTimeLastAction(), + 'isVisitorGoalConverted' => $this->isVisitorGoalConverted(), + 'goalIcon' => $this->getGoalIcon(), + 'goalType' => $this->getGoalType(), ); } - + function getServerDate() { - return $this->details['visit_server_date']; + return date('Y-m-d', strtotime($this->details['visit_last_action_time'])); } - + function getIp() { if(isset($this->details['location_ip'])) @@ -89,17 +91,17 @@ class Piwik_Live_Visitor } return false; } - + function getIdVisit() { return $this->details['idvisit']; } - + function getIdSite() { return $this->details['idsite']; } - + function getNumberOfActions() { return $this->details['visit_total_actions']; @@ -109,42 +111,42 @@ class Piwik_Live_Visitor { return $this->details['visit_total_time']; } - + function getVisitLengthPretty() { return Piwik::getPrettyTimeFromSeconds($this->details['visit_total_time']); } - + function isVisitorReturning() { return $this->details['visitor_returning']; } - + function getTimestampFirstAction() { return strtotime($this->details['visit_first_action_time']); } - + function getTimestampLastAction() { return strtotime($this->details['visit_last_action_time']); } - + function getCountryName() { return Piwik_CountryTranslate($this->details['location_country']); } - + function getCountryFlag() { return Piwik_getFlagFromCode($this->details['location_country']); } - + function getContinent() { return Piwik_ContinentTranslate($this->details['location_continent']); } - + function getRefererType() { $map = array( @@ -159,27 +161,27 @@ class Piwik_Live_Visitor } return $map[Piwik_Common::REFERER_TYPE_DIRECT_ENTRY]; } - + function getRefererTypeName() { return Piwik_getRefererTypeLabel($this->details['referer_type']); } - + function getKeywords() { return $this->details['referer_keyword']; } - + function getRefererUrl() { - return $this->details['referer_url']; + return $this->details['referer_url']; } - + function getRefererName() { - return $this->details['referer_name']; + return $this->details['referer_name']; } - + function getSearchEngineUrl() { if($this->getRefererType() == 'searchEngine' @@ -189,7 +191,7 @@ class Piwik_Live_Visitor } return null; } - + function getSearchEngineIcon() { $searchEngineUrl = $this->getSearchEngineUrl(); @@ -202,7 +204,7 @@ class Piwik_Live_Visitor function getPlugins() { - $plugins = array( + $plugins = array( 'config_pdf', 'config_flash', 'config_java', @@ -216,10 +218,10 @@ class Piwik_Live_Visitor $return = array(); foreach($plugins as $plugin) { - if($this->details[$plugin] == 1) + if($this->details[$plugin] == 1) { $pluginShortName = substr($plugin, 7); - $return[] = $pluginShortName; + $return[] = $pluginShortName; } } return implode(", ", $return); @@ -229,12 +231,12 @@ class Piwik_Live_Visitor { return Piwik_getOSLabel($this->details['config_os']); } - + function getOperatingSystemShortName() { return Piwik_getOSShortLabel($this->details['config_os']); } - + function getOperatingSystemIcon() { return Piwik_getOSLogo($this->details['config_os']); @@ -244,44 +246,82 @@ class Piwik_Live_Visitor { return Piwik_getBrowserTypeLabel($this->getBrowserFamily()); } - + function getBrowserFamily() { return Piwik_getBrowserFamily($this->details['config_browser_name']); } - + function getBrowser() { return Piwik_getBrowserLabel($this->details['config_browser_name'] . ";" . $this->details['config_browser_version']); } - + function getBrowserIcon() { return Piwik_getBrowsersLogo($this->details['config_browser_name'] . ";" . $this->details['config_browser_version']); } - + function getScreenType() { return Piwik_getScreenTypeFromResolution($this->details['config_resolution']); } - + function getResolution() { return $this->details['config_resolution']; } - + function getScreenTypeIcon() { return Piwik_getScreensLogo($this->getScreenType()); } - + function getProvider() { return Piwik_getHostnameName($this->details['location_provider']); } - + function getProviderUrl() { return Piwik_getHostnameUrl($this->details['location_provider']); } + + function getDateTimeLastAction() + { + return date('Y-m-d H:i:s', strtotime($this->details['visit_last_action_time'])); + } + + function isVisitorGoalConverted() + { + return $this->details['visit_goal_converted']; + } + + function getGoalType() + { + if(isset($this->details['match_attribute'])){ + return $this->details['match_attribute']; + } + return false; + } + + function getGoalIcon() + { + if(isset($this->details['match_attribute'])){ + $goalicon = ""; + switch ($this->details['match_attribute']) { + case "url": + $goalicon = "plugins/Live/templates/images/goal.png"; + break; + case "file": + $goalicon = "plugins/Live/templates/images/download.png"; + break; + case "external_website": + $goalicon = "plugins/Live/templates/images/outboundlink.png"; + break; + } + return $goalicon; + } + return false; + } } |