diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-08-25 17:14:23 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-08-26 11:23:38 +0400 |
commit | ade4198dd4bdcfd7c03119bb52208e006bf64082 (patch) | |
tree | 4cfb4e9eaf3a09ac765d16a40927c7cd111353da /plugins/Live | |
parent | 63777c8158e50e4da66b13bb96c360f2550fcd0f (diff) |
refs #6045 #6049 added an event to collect visitor info and made sure the Piwik UI kinda works when most tracker plugins are disabled
Diffstat (limited to 'plugins/Live')
-rw-r--r-- | plugins/Live/API.php | 3 | ||||
-rw-r--r-- | plugins/Live/Visitor.php | 518 | ||||
-rw-r--r-- | plugins/Live/templates/_dataTableViz_visitorLog.twig | 14 | ||||
-rw-r--r-- | plugins/Live/templates/getLastVisitsStart.twig | 10 | ||||
-rw-r--r-- | plugins/Live/templates/getSingleVisitSummary.twig | 15 |
5 files changed, 32 insertions, 528 deletions
diff --git a/plugins/Live/API.php b/plugins/Live/API.php index f2b38177e8..b18dedf598 100644 --- a/plugins/Live/API.php +++ b/plugins/Live/API.php @@ -29,6 +29,7 @@ use Piwik\Tracker; * @see plugins/Live/Visitor.php */ require_once PIWIK_INCLUDE_PATH . '/plugins/Live/Visitor.php'; +require_once PIWIK_INCLUDE_PATH . '/plugins/UserCountry/functions.php'; /** * The Live! API lets you access complete visit level information about your visitors. Combined with the power of <a href='http://piwik.org/docs/analytics-api/segmentation/' target='_blank'>Segmentation</a>, @@ -301,7 +302,7 @@ class API extends \Piwik\Plugin\API } ++$continents[$continentCode]; - if (!array_key_exists($countryCode, $cities)) { + if ($countryCode && !array_key_exists($countryCode, $cities)) { $cities[$countryCode] = array(); } $city = $visit->getColumn('city'); diff --git a/plugins/Live/Visitor.php b/plugins/Live/Visitor.php index a82b9fac42..2d3c0b68a3 100644 --- a/plugins/Live/Visitor.php +++ b/plugins/Live/Visitor.php @@ -15,37 +15,19 @@ use Piwik\Date; use Piwik\Db; use Piwik\IP; use Piwik\Piwik; -use Piwik\Plugins\CoreHome\Columns\VisitGoalBuyer; use Piwik\Plugins\CustomVariables\CustomVariables; -use Piwik\Plugins\Referrers\API as APIReferrers; use Piwik\Plugins\UserCountry\LocationProvider\GeoIp; use Piwik\Plugins\Actions\Actions\ActionSiteSearch; use Piwik\Tracker; use Piwik\Tracker\Action; use Piwik\Tracker\GoalManager; -use Piwik\Tracker\Visit; -use Piwik\UrlHelper; -/** - * @see plugins/Referrers/functions.php - * @see plugins/UserCountry/functions.php - * @see plugins/UserSettings/functions.php - * @see plugins/Provider/functions.php - */ - -require_once PIWIK_INCLUDE_PATH . '/plugins/Referrers/functions.php'; -require_once PIWIK_INCLUDE_PATH . '/plugins/UserCountry/functions.php'; -require_once PIWIK_INCLUDE_PATH . '/plugins/UserSettings/functions.php'; -require_once PIWIK_INCLUDE_PATH . '/plugins/Provider/functions.php'; - -/** - */ class Visitor implements VisitorInterface { - const DELIMITER_PLUGIN_NAME = ", "; - const EVENT_VALUE_PRECISION = 3; + private $details = array(); + function __construct($visitorRawData) { $this->details = $visitorRawData; @@ -53,84 +35,28 @@ class Visitor implements VisitorInterface function getAllVisitorDetails() { - return array( + $visitor = array( 'idSite' => $this->getIdSite(), 'idVisit' => $this->getIdVisit(), 'visitIp' => $this->getIp(), 'visitorId' => $this->getVisitorId(), - 'visitorType' => $this->getVisitorReturning(), - 'visitorTypeIcon' => $this->getVisitorReturningIcon(), - 'visitConverted' => $this->isVisitorGoalConverted(), - 'visitConvertedIcon' => $this->getVisitorGoalConvertedIcon(), - 'visitEcommerceStatus' => $this->getVisitEcommerceStatus(), - 'visitEcommerceStatusIcon' => $this->getVisitEcommerceStatusIcon(), - - 'searches' => $this->getNumberOfSearches(), - 'events' => $this->getNumberOfEvents(), - 'actions' => $this->getNumberOfActions(), + // => false are placeholders to be filled in API later 'actionDetails' => false, - 'customVariables' => $this->getCustomVariables(), 'goalConversions' => false, 'siteCurrency' => false, 'siteCurrencySymbol' => false, // all time entries 'serverDate' => $this->getServerDate(), - 'visitLocalTime' => $this->getVisitLocalTime(), - 'visitLocalHour' => $this->getVisitLocalHour(), 'visitServerHour' => $this->getVisitServerHour(), - 'firstActionTimestamp' => $this->getTimestampFirstAction(), 'lastActionTimestamp' => $this->getTimestampLastAction(), 'lastActionDateTime' => $this->getDateTimeLastAction(), - - // standard attributes - 'visitDuration' => $this->getVisitLength(), - 'visitDurationPretty' => $this->getVisitLengthPretty(), - 'visitCount' => $this->getVisitCount(), - 'daysSinceLastVisit' => $this->getDaysSinceLastVisit(), - 'daysSinceFirstVisit' => $this->getDaysSinceFirstVisit(), - 'daysSinceLastEcommerceOrder' => $this->getDaysSinceLastEcommerceOrder(), - 'continent' => $this->getContinent(), - 'continentCode' => $this->getContinentCode(), - 'country' => $this->getCountryName(), - 'countryCode' => $this->getCountryCode(), - 'countryFlag' => $this->getCountryFlag(), - 'region' => $this->getRegionName(), - 'regionCode' => $this->getRegionCode(), - 'city' => $this->getCityName(), - 'location' => $this->getPrettyLocation(), - 'latitude' => $this->getLatitude(), - 'longitude' => $this->getLongitude(), - 'provider' => $this->getProvider(), - 'providerName' => $this->getProviderName(), - 'providerUrl' => $this->getProviderUrl(), - - 'referrerType' => $this->getReferrerType(), - 'referrerTypeName' => $this->getReferrerTypeName(), - 'referrerName' => $this->getReferrerName(), - 'referrerKeyword' => $this->getKeyword(), - 'referrerKeywordPosition' => $this->getKeywordPosition(), - 'referrerUrl' => $this->getReferrerUrl(), - 'referrerSearchEngineUrl' => $this->getSearchEngineUrl(), - 'referrerSearchEngineIcon' => $this->getSearchEngineIcon(), - 'operatingSystem' => $this->getOperatingSystem(), - 'operatingSystemCode' => $this->getOperatingSystemCode(), - 'operatingSystemShortName' => $this->getOperatingSystemShortName(), - 'operatingSystemIcon' => $this->getOperatingSystemIcon(), - 'browserFamily' => $this->getBrowserFamily(), - 'browserFamilyDescription' => $this->getBrowserFamilyDescription(), - 'browserName' => $this->getBrowser(), - 'browserIcon' => $this->getBrowserIcon(), - 'browserCode' => $this->getBrowserCode(), - 'browserVersion' => $this->getBrowserVersion(), - 'screenType' => $this->getScreenType(), - 'deviceType' => $this->getDeviceType(), - 'resolution' => $this->getResolution(), - 'screenTypeIcon' => $this->getScreenTypeIcon(), - 'plugins' => $this->getPlugins(), - 'pluginsIcons' => $this->getPluginIcons(), ); + + Piwik::postEvent('Live.getAllVisitorDetails', array(&$visitor, $this->details)); + + return $visitor; } function getVisitorId() @@ -141,41 +67,11 @@ class Visitor implements VisitorInterface return false; } - function getVisitLocalTime() - { - return $this->details['visitor_localtime']; - } - function getVisitServerHour() { return date('G', strtotime($this->details['visit_last_action_time'])); } - function getVisitLocalHour() - { - return date('G', strtotime('2012-12-21 ' . $this->details['visitor_localtime'])); - } - - function getVisitCount() - { - return $this->details['visitor_count_visits']; - } - - function getDaysSinceLastVisit() - { - return $this->details['visitor_days_since_last']; - } - - function getDaysSinceLastEcommerceOrder() - { - return $this->details['visitor_days_since_order']; - } - - function getDaysSinceFirstVisit() - { - return $this->details['visitor_days_since_first']; - } - function getServerDate() { return date('Y-m-d', strtotime($this->details['visit_last_action_time'])); @@ -199,412 +95,16 @@ class Visitor implements VisitorInterface return $this->details['idsite']; } - function getNumberOfActions() - { - return $this->details['visit_total_actions']; - } - - function getNumberOfEvents() - { - return $this->details['visit_total_events']; - } - - function getNumberOfSearches() - { - return $this->details['visit_total_searches']; - } - - function getVisitLength() - { - return $this->details['visit_total_time']; - } - - function getVisitLengthPretty() - { - return \Piwik\MetricsFormatter::getPrettyTimeFromSeconds($this->details['visit_total_time']); - } - - function getVisitorReturning() - { - $type = $this->details['visitor_returning']; - return $type == 2 - ? 'returningCustomer' - : ($type == 1 - ? 'returning' - : 'new'); - } - - function getVisitorReturningIcon() - { - $type = $this->getVisitorReturning(); - if ($type == 'returning' - || $type == 'returningCustomer' - ) { - return "plugins/Live/images/returningVisitor.gif"; - } - return null; - } - - function getTimestampFirstAction() - { - return strtotime($this->details['visit_first_action_time']); - } - function getTimestampLastAction() { return strtotime($this->details['visit_last_action_time']); } - function getCountryCode() - { - return $this->details['location_country']; - } - - function getCountryName() - { - return \Piwik\Plugins\UserCountry\countryTranslate($this->getCountryCode()); - } - - function getCountryFlag() - { - return \Piwik\Plugins\UserCountry\getFlagFromCode($this->getCountryCode()); - } - - function getContinent() - { - return \Piwik\Plugins\UserCountry\continentTranslate($this->getContinentCode()); - } - - function getContinentCode() - { - return Common::getContinent($this->details['location_country']); - } - - function getCityName() - { - if (!empty($this->details['location_city'])) { - return $this->details['location_city']; - } - return null; - } - - public function getRegionName() - { - $region = $this->getRegionCode(); - if ($region != '' && $region != Visit::UNKNOWN_CODE) { - return GeoIp::getRegionNameFromCodes( - $this->details['location_country'], $region); - } - return null; - } - - public function getRegionCode() - { - return $this->details['location_region']; - } - - function getPrettyLocation() - { - $parts = array(); - - $city = $this->getCityName(); - if (!empty($city)) { - $parts[] = $city; - } - $region = $this->getRegionName(); - if (!empty($region)) { - $parts[] = $region; - } - - // add country & return concatenated result - $parts[] = $this->getCountryName(); - return implode(', ', $parts); - } - - function getLatitude() - { - if (!empty($this->details['location_latitude'])) { - return $this->details['location_latitude']; - } - return null; - } - - function getLongitude() - { - if (!empty($this->details['location_longitude'])) { - return $this->details['location_longitude']; - } - return null; - } - - function getCustomVariables() - { - $customVariables = array(); - - $maxCustomVariables = CustomVariables::getMaxCustomVariables(); - - for ($i = 1; $i <= $maxCustomVariables; $i++) { - if (!empty($this->details['custom_var_k' . $i])) { - $customVariables[$i] = array( - 'customVariableName' . $i => $this->details['custom_var_k' . $i], - 'customVariableValue' . $i => $this->details['custom_var_v' . $i], - ); - } - } - return $customVariables; - } - - function getReferrerType() - { - return \Piwik\Plugins\Referrers\getReferrerTypeFromShortName($this->details['referer_type']); - } - - function getReferrerTypeName() - { - return \Piwik\Plugins\Referrers\getReferrerTypeLabel($this->details['referer_type']); - } - - function getKeyword() - { - $keyword = $this->details['referer_keyword']; - if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('Referrers') - && $this->getReferrerType() == 'search' - ) { - $keyword = \Piwik\Plugins\Referrers\API::getCleanKeyword($keyword); - } - return urldecode($keyword); - } - - function getReferrerUrl() - { - if ($this->getReferrerType() == 'search') { - if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('Referrers') - && $this->details['referer_keyword'] == APIReferrers::LABEL_KEYWORD_NOT_DEFINED - ) { - return 'http://piwik.org/faq/general/#faq_144'; - } // Case URL is google.XX/url.... then we rewrite to the search result page url - elseif ($this->getReferrerName() == 'Google' - && strpos($this->details['referer_url'], '/url') - ) { - $refUrl = @parse_url($this->details['referer_url']); - if (isset($refUrl['host'])) { - $url = \Piwik\Plugins\Referrers\getSearchEngineUrlFromUrlAndKeyword('http://google.com', $this->getKeyword()); - $url = str_replace('google.com', $refUrl['host'], $url); - return $url; - } - } - } - if (\Piwik\UrlHelper::isLookLikeUrl($this->details['referer_url'])) { - return $this->details['referer_url']; - } - return null; - } - - function getKeywordPosition() - { - if ($this->getReferrerType() == 'search' - && strpos($this->getReferrerName(), 'Google') !== false - ) { - $url = @parse_url($this->details['referer_url']); - if (empty($url['query'])) { - return null; - } - $position = UrlHelper::getParameterFromQueryString($url['query'], 'cd'); - if (!empty($position)) { - return $position; - } - } - return null; - } - - function getReferrerName() - { - return urldecode($this->details['referer_name']); - } - - function getSearchEngineUrl() - { - if ($this->getReferrerType() == 'search' - && !empty($this->details['referer_name']) - ) { - return \Piwik\Plugins\Referrers\getSearchEngineUrlFromName($this->details['referer_name']); - } - return null; - } - - function getSearchEngineIcon() - { - $searchEngineUrl = $this->getSearchEngineUrl(); - if (!is_null($searchEngineUrl)) { - return \Piwik\Plugins\Referrers\getSearchEngineLogoFromUrl($searchEngineUrl); - } - return null; - } - - function getPlugins() - { - $plugins = array( - 'config_pdf', - 'config_flash', - 'config_java', - 'config_director', - 'config_quicktime', - 'config_realplayer', - 'config_windowsmedia', - 'config_gears', - 'config_silverlight', - ); - $pluginShortNames = array(); - foreach ($plugins as $plugin) { - if ($this->details[$plugin] == 1) { - $pluginShortName = substr($plugin, 7); - $pluginShortNames[] = $pluginShortName; - } - } - return implode(self::DELIMITER_PLUGIN_NAME, $pluginShortNames); - } - - function getPluginIcons() - { - $pluginNames = $this->getPlugins(); - if (!empty($pluginNames)) { - $pluginNames = explode(self::DELIMITER_PLUGIN_NAME, $pluginNames); - $pluginIcons = array(); - - foreach ($pluginNames as $plugin) { - $pluginIcons[] = array("pluginIcon" => \Piwik\Plugins\UserSettings\getPluginsLogo($plugin), "pluginName" => $plugin); - } - return $pluginIcons; - } - return null; - } - - function getOperatingSystemCode() - { - return $this->details['config_os']; - } - - function getOperatingSystem() - { - return \Piwik\Plugins\UserSettings\getOSLabel($this->details['config_os']); - } - - function getOperatingSystemShortName() - { - return \Piwik\Plugins\UserSettings\getOSShortLabel($this->details['config_os']); - } - - function getOperatingSystemIcon() - { - return \Piwik\Plugins\UserSettings\getOSLogo($this->details['config_os']); - } - - function getBrowserFamilyDescription() - { - return \Piwik\Plugins\UserSettings\getBrowserTypeLabel($this->getBrowserFamily()); - } - - function getBrowserFamily() - { - return \Piwik\Plugins\UserSettings\getBrowserFamily($this->details['config_browser_name']); - } - - function getBrowserCode() - { - return $this->details['config_browser_name']; - } - - function getBrowserVersion() - { - return $this->details['config_browser_version']; - } - - function getBrowser() - { - return \Piwik\Plugins\UserSettings\getBrowserLabel($this->details['config_browser_name'] . ";" . $this->details['config_browser_version']); - } - - function getBrowserIcon() - { - return \Piwik\Plugins\UserSettings\getBrowsersLogo($this->details['config_browser_name'] . ";" . $this->details['config_browser_version']); - } - - function getScreenType() - { - return \Piwik\Plugins\UserSettings\getScreenTypeFromResolution($this->details['config_resolution']); - } - - function getDeviceType() - { - if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('DevicesDetection')) { - return \Piwik\Plugins\DevicesDetection\getDeviceTypeLabel($this->details['config_device_type']); - } - return false; - } - - function getResolution() - { - return $this->details['config_resolution']; - } - - function getScreenTypeIcon() - { - return \Piwik\Plugins\UserSettings\getScreensLogo($this->getScreenType()); - } - - function getProvider() - { - if (isset($this->details['location_provider'])) { - return $this->details['location_provider']; - } else { - return Piwik::translate('General_Unknown'); - } - } - - function getProviderName() - { - return \Piwik\Plugins\Provider\getPrettyProviderName($this->getProvider()); - } - - function getProviderUrl() - { - return \Piwik\Plugins\Provider\getHostnameUrl(@$this->details['location_provider']); - } - function getDateTimeLastAction() { return date('Y-m-d H:i:s', strtotime($this->details['visit_last_action_time'])); } - function getVisitEcommerceStatusIcon() - { - $status = $this->getVisitEcommerceStatus(); - - if (in_array($status, array('ordered', 'orderedThenAbandonedCart'))) { - return "plugins/Morpheus/images/ecommerceOrder.gif"; - } elseif ($status == 'abandonedCart') { - return "plugins/Morpheus/images/ecommerceAbandonedCart.gif"; - } - return null; - } - - function getVisitEcommerceStatus() - { - return VisitGoalBuyer::getVisitEcommerceStatusFromId($this->details['visit_goal_buyer']); - } - - function getVisitorGoalConvertedIcon() - { - return $this->isVisitorGoalConverted() - ? "plugins/Morpheus/images/goal.png" - : null; - } - - function isVisitorGoalConverted() - { - return $this->details['visit_goal_converted']; - } - /** * Removes fields that are not meant to be displayed (md5 config hash) * Or that the user should only access if he is Super User or admin (cookie, IP) @@ -768,8 +268,6 @@ class Visitor implements VisitorInterface $actionDetail =& $actionDetails[$actionIdx]; $customVariablesPage = array(); - $maxCustomVariables = CustomVariables::getMaxCustomVariables(); - for ($i = 1; $i <= $maxCustomVariables; $i++) { if (!empty($actionDetail['custom_var_k' . $i])) { $cvarKey = $actionDetail['custom_var_k' . $i]; diff --git a/plugins/Live/templates/_dataTableViz_visitorLog.twig b/plugins/Live/templates/_dataTableViz_visitorLog.twig index e238e75d16..f4389cdd29 100644 --- a/plugins/Live/templates/_dataTableViz_visitorLog.twig +++ b/plugins/Live/templates/_dataTableViz_visitorLog.twig @@ -27,20 +27,20 @@ {% for visitor in dataTable.getRows() %} {% set breakBeforeVisitorRank = (visitor.getColumn('visitEcommerceStatusIcon') and visitor.getColumn('visitorTypeIcon')) ? true : false %} {% set visitorColumnContent %} - <img src="{{ visitor.getColumn('countryFlag') }}" title="{{ visitor.getColumn('location') }}, Provider {{ visitor.getColumn('providerName') }}"/> + {% if visitor.getColumn('countryFlag') %}<img src="{{ visitor.getColumn('countryFlag') }}" title="{{ visitor.getColumn('location') }}, Provider {{ visitor.getColumn('providerName') }}"/>{% endif %} {% if visitor.getColumn('plugins') %} - <img src="{{ visitor.getColumn('browserIcon') }}" title="{{ 'UserSettings_BrowserWithPluginsEnabled'|translate(visitor.getColumn('browserName'),visitor.getColumn('plugins')) }}"/> + {% if visitor.getColumn('browserIcon') %}<img src="{{ visitor.getColumn('browserIcon') }}" title="{{ 'UserSettings_BrowserWithPluginsEnabled'|translate(visitor.getColumn('browserName'),visitor.getColumn('plugins')) }}"/>{% endif %} {% else %} - <img src="{{ visitor.getColumn('browserIcon') }}" title="{{ 'UserSettings_BrowserWithNoPluginsEnabled'|translate(visitor.getColumn('browserName')) }}"/> + {% if visitor.getColumn('browserIcon') %}<img src="{{ visitor.getColumn('browserIcon') }}" title="{{ 'UserSettings_BrowserWithNoPluginsEnabled'|translate(visitor.getColumn('browserName')) }}"/>{% endif %} {% endif %} - + {% if visitor.getColumn('operatingSystemIcon') %} <img src="{{ visitor.getColumn('operatingSystemIcon') }}" - title="{{ visitor.getColumn('operatingSystem') }}, {{ visitor.getColumn('resolution') }} ({{ visitor.getColumn('screenType') }})"/> + title="{{ visitor.getColumn('operatingSystem') }}, {{ visitor.getColumn('resolution') }} ({{ visitor.getColumn('screenType') }})"/>{% endif %} {% if visitor.getColumn('visitorTypeIcon') %} - - + {% if visitor.getColumn('visitorTypeIcon') %} - <img src="{{ visitor.getColumn('visitorTypeIcon') }}" - title="{{ 'General_ReturningVisitor'|translate }} - {{ 'General_NVisits'|translate(visitor.getColumn('visitCount')) }}"/> + title="{{ 'General_ReturningVisitor'|translate }} - {{ 'General_NVisits'|translate(visitor.getColumn('visitCount')) }}"/>{% endif %} {% endif %} {% if not displayVisitorsInOwnColumn or breakBeforeVisitorRank %}<br/><br />{% endif %} {% if visitor.getColumn('visitConverted') %} diff --git a/plugins/Live/templates/getLastVisitsStart.twig b/plugins/Live/templates/getLastVisitsStart.twig index e6df66009f..a165112f50 100644 --- a/plugins/Live/templates/getLastVisitsStart.twig +++ b/plugins/Live/templates/getLastVisitsStart.twig @@ -8,9 +8,9 @@ <div title="{{ visitor.actionDetails|length }} {{ 'General_Actions'|translate }}" class="datetime"> <span style="display:none;" class="serverTimestamp">{{ visitor.serverTimestamp|raw }}</span> {{ visitor.serverDatePretty }} - {{ visitor.serverTimePretty }} {% if visitor.visitDuration > 0 %}<em>({{ visitor.visitDurationPretty|raw }})</em>{% endif %} - <img src="{{ visitor.countryFlag }}" title="{{ visitor.location }}, {{ 'Provider_ColumnProvider'|translate }} {{ visitor.providerName }}"/> - <img src="{{ visitor.browserIcon }}" title="{{ visitor.browserName }}, {{ 'General_Plugins'|translate }}: {{ visitor.plugins }}"/> - <img src="{{ visitor.operatingSystemIcon }}" title="{{ visitor.operatingSystem }}, {{ visitor.resolution }}"/> + {% if visitor.countryFlag is defined %} <img src="{{ visitor.countryFlag }}" title="{{ visitor.location }}, {{ 'Provider_ColumnProvider'|translate }} {% if visitor.providerName is defined %}{{ visitor.providerName }}{% endif %}"/>{% endif %} + {% if visitor.browserIcon is defined %} <img src="{{ visitor.browserIcon }}" title="{{ visitor.browserName }}, {{ 'General_Plugins'|translate }}: {{ visitor.plugins }}"/>{% endif %} + {% if visitor.operatingSystemIcon is defined %} <img src="{{ visitor.operatingSystemIcon }}" title="{{ visitor.operatingSystem }}, {{ visitor.resolution }}"/>{% endif %} {% if visitor.visitConverted %} <span title="{{ 'General_VisitConvertedNGoals'|translate(visitor.goalConversions) }}" class='visitorRank'> @@ -37,7 +37,7 @@ </div> <!--<div class="settings"></div>--> <div class="referrer"> - {% if visitor.referrerType != 'direct' %} + {% if visitor.referrerType is defined and visitor.referrerType != 'direct' %} {{ 'General_FromReferrer'|translate }} {% if visitor.referrerUrl is not empty %} <a href="{{ visitor.referrerUrl }}" target="_blank"> @@ -58,7 +58,7 @@ <span class='hash'>#</span> {{ visitor.referrerKeywordPosition }} </span> {% endif %} - {% else %} + {% elseif visitor.referrerType is defined %} {{ 'Referrers_DirectEntry'|translate }} {% endif %} </div> diff --git a/plugins/Live/templates/getSingleVisitSummary.twig b/plugins/Live/templates/getSingleVisitSummary.twig index 20b493c691..aa378a6ccd 100644 --- a/plugins/Live/templates/getSingleVisitSummary.twig +++ b/plugins/Live/templates/getSingleVisitSummary.twig @@ -12,7 +12,7 @@ <div class="visitor-profile-latest-visit-column"> <ul> <li> - <span>{{ 'General_IP'|translate }}</span><strong {% if visitData.providerName is not empty %}title="{{ 'Provider_ColumnProvider'|translate }}: {{ visitData.providerName }}"{% endif %}>{{ visitData.visitIp }}</strong> + <span>{{ 'General_IP'|translate }}</span><strong {% if visitData.providerName is defined and visitData.providerName is not empty %}title="{{ 'Provider_ColumnProvider'|translate }}: {{ visitData.providerName }}"{% endif %}>{{ visitData.visitIp }}</strong> </li> <li class="visitor-profile-id"> <span>{{ 'General_Id'|translate|upper }}</span> @@ -24,14 +24,17 @@ </a> </li> <li> + {% if visitData.browserName is defined %} <div class="visitor-profile-browser" title="{% if visitData.plugins is defined %}{{ 'UserSettings_BrowserWithPluginsEnabled'|translate(visitData.browserName, visitData.plugins) }}{% else %}{{ 'UserSettings_BrowserWithNoPluginsEnabled'|translate(visitData.browserName) }}{% endif %}"> - <img src="{{ visitData.browserIcon }}"/><span>{{ visitData.browserName|split(' ')[0] }}</span> + {% if visitData.browserIcon is defined %}<img src="{{ visitData.browserIcon }}"/>{% endif %}<span>{{ visitData.browserName|split(' ')[0] }}</span> </div> + {% endif %} + <div class="visitor-profile-os"> - <img src="{{ visitData.operatingSystemIcon }}"/><span>{{ visitData.operatingSystemShortName }}</span> + {% if visitData.operatingSystemIcon is defined %}<img src="{{ visitData.operatingSystemIcon }}"/>{% endif %}{% if visitData.operatingSystemShortName is defined %}<span>{{ visitData.operatingSystemShortName }}</span>{% endif %} </div> </li> - <li><span>{{ 'UserSettings_ColumnResolution'|translate }}</span><strong>{{ visitData.resolution }}</strong></li> + {% if visitData.resolution is defined %}<li><span>{{ 'UserSettings_ColumnResolution'|translate }}</span><strong>{{ visitData.resolution }}</strong></li>{% endif %} {% if visitReferralSummary is defined %} {%- set keywordNotDefined = 'General_NotDefined'|translate('General_ColumnKeyword'|translate) -%} <li> @@ -42,6 +45,7 @@ </ul> </div> <div class="visitor-profile-latest-visit-column"> + {% if visitData.customVariables is defined %} <ul> {% for id,customVariable in visitData.customVariables %} {% if loop.index0 < 4 %} @@ -49,7 +53,8 @@ {% endif %} {% endfor %} </ul> - {% if visitData.customVariables|length > 4 %} + {% endif %} + {% if visitData.customVariables is defined and visitData.customVariables|length > 4 %} <ul class="visitor-profile-extra-cvars" style="display:none;"> {% for id,customVariable in visitData.customVariables %} {% if loop.index0 >= 4 %} |