diff options
author | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-09-12 06:31:23 +0400 |
---|---|---|
committer | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-09-12 06:31:23 +0400 |
commit | d989c794c832d40a66f7a56e6e0607a20e4a7af5 (patch) | |
tree | 2be381ef58115059aab81282da8a6b88489f7a19 /plugins | |
parent | d6f94510ca16b4f6b06d5113c97fa206f704b489 (diff) |
Refs #3089, tweaks to getVisitorProfile API output. Includes change that allows xml renderers to use special keys when rendering arrays.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Live/API.php | 19 | ||||
-rw-r--r-- | plugins/Live/templates/getVisitorProfilePopup.twig | 7 |
2 files changed, 14 insertions, 12 deletions
diff --git a/plugins/Live/API.php b/plugins/Live/API.php index 85ac7c28cd..8cd7f37a3e 100644 --- a/plugins/Live/API.php +++ b/plugins/Live/API.php @@ -196,7 +196,7 @@ class API $result = array(); $result['totalVisits'] = 0; $result['totalVisitDuration'] = 0; - $result['totalActionCount'] = 0; + $result['totalActions'] = 0; $result['totalGoalConversions'] = 0; $result['totalConversionsByGoal'] = array(); @@ -217,24 +217,25 @@ class API ++$result['totalVisits']; $result['totalVisitDuration'] += $visit->getColumn('visitDuration'); - $result['totalActionCount'] += $visit->getColumn('actions'); + $result['totalActions'] += $visit->getColumn('actions'); $result['totalGoalConversions'] += $visit->getColumn('goalConversions'); // individual goal conversions are stored in action details foreach ($visit->getColumn('actionDetails') as $action) { if ($action['type'] == 'goal') { // handle goal conversion $idGoal = $action['goalId']; + $idGoalKey = 'idgoal=' . $idGoal; - if (!isset($result['totalConversionsByGoal'][$idGoal])) { - $result['totalConversionsByGoal'][$idGoal] = 0; + if (!isset($result['totalConversionsByGoal'][$idGoalKey])) { + $result['totalConversionsByGoal'][$idGoalKey] = 0; } - ++$result['totalConversionsByGoal'][$idGoal]; + ++$result['totalConversionsByGoal'][$idGoalKey]; if (!empty($action['revenue'])) { - if (!isset($result['totalRevenueByGoal'][$idGoal])) { - $result['totalRevenueByGoal'][$idGoal] = 0; + if (!isset($result['totalRevenueByGoal'][$idGoalKey])) { + $result['totalRevenueByGoal'][$idGoalKey] = 0; } - $result['totalRevenueByGoal'][$idGoal] += $action['revenue']; + $result['totalRevenueByGoal'][$idGoalKey] += $action['revenue']; } } else if ($action['type'] == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER // handle ecommerce order && $isEcommerceEnabled @@ -310,7 +311,7 @@ class API // looking at the popup. $latestVisitTime = reset($rows)->getColumn('lastActionDateTime'); $result['nextVisitorId'] = $this->getAdjacentVisitorId($idSite, $visitorId, $latestVisitTime, $segment, $getNext = true); - $result['prevVisitorId'] = $this->getAdjacentVisitorId($idSite, $visitorId, $latestVisitTime, $segment, $getNext = false); + $result['previousVisitorId'] = $this->getAdjacentVisitorId($idSite, $visitorId, $latestVisitTime, $segment, $getNext = false); Piwik_PostEvent(Live::GET_EXTRA_VISITOR_DETAILS_EVENT, array(&$result)); diff --git a/plugins/Live/templates/getVisitorProfilePopup.twig b/plugins/Live/templates/getVisitorProfilePopup.twig index 571f742be4..bba6323006 100644 --- a/plugins/Live/templates/getVisitorProfilePopup.twig +++ b/plugins/Live/templates/getVisitorProfilePopup.twig @@ -2,7 +2,7 @@ <div class="visitor-profile" data-visitor-id="{{ visitorData.lastVisits.getFirstRow().getColumn('visitorId') }}" data-next-visitor="{{ visitorData.nextVisitorId }}" - data-prev-visitor="{{ visitorData.prevVisitorId }}" + data-prev-visitor="{{ visitorData.previousVisitorId }}" tabindex="0"> <a href class="visitor-profile-close"></a> <div class="visitor-profile-info"> @@ -18,7 +18,7 @@ </div> <div> <div class="visitor-profile-header"> - {% if visitorData.prevVisitorId is not empty %}<a class="visitor-profile-prev-visitor" href="#" title="{{ 'Live_PreviousVisitor'|translate }}">←</a>{% endif %} + {% if visitorData.previousVisitorId is not empty %}<a class="visitor-profile-prev-visitor" href="#" title="{{ 'Live_PreviousVisitor'|translate }}">←</a>{% endif %} <h1>{{ 'Live_VisitorProfile'|translate }} <img class="loadingPiwik" style="display:none;" src="plugins/Zeitgeist/images/loading-blue.gif"/></h1> {% if visitorData.nextVisitorId is not empty %}<a class="visitor-profile-next-visitor" href="#" title="{{ 'Live_NextVisitor'|translate }}">→</a>{% endif %} </div> @@ -31,10 +31,11 @@ <div class="visitor-profile-summary"> <h1>{{ 'General_Summary'|translate }}</h1> <div> - <p>{{ 'Live_VisitSummary'|translate('<strong>', visitorData.totalVisitDurationPretty, '</strong>', '<strong>', visitorData.totalActionCount, visitorData.totalVisits, '</strong>')|raw }}</p> + <p>{{ 'Live_VisitSummary'|translate('<strong>', visitorData.totalVisitDurationPretty, '</strong>', '<strong>', visitorData.totalActions, visitorData.totalVisits, '</strong>')|raw }}</p> <p><strong>{{ 'Live_ConvertedNGoals'|translate(visitorData.totalGoalConversions) }}</strong> {%- if visitorData.totalGoalConversions %} ( {%- for idGoal, totalConversions in visitorData.totalConversionsByGoal -%} + {%- set idGoal = idGoal[7:] -%} {%- if not loop.first %}, {% endif -%}{{- totalConversions }} <span class="visitor-profile-goal-name">{{ goals[idGoal]['name'] -}}</span> {%- endfor -%} ){% endif %}.</p> |