Skip to content
Extraits de code Groupes Projets
Valider 41b743af rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

Merge pull request #9460 from piwik/8855

Display action details in visitor profile (if other than pageviews)
parents d79af641 17d1165d
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -57,8 +57,12 @@ class VisitorProfile
// individual goal conversions are stored in action details
foreach ($visit->getColumn('actionDetails') as $action) {
$this->handleIfGoalAction($action);
$this->handleIfEventAction($action);
$this->handleIfDownloadAction($action);
$this->handleIfOutlinkAction($action);
$this->handleIfEcommerceAction($action);
$this->handleIfSiteSearchAction($action);
$this->handleIfPageViewAction($action);
$this->handleIfPageGenerationTime($action);
}
$this->handleGeoLocation($visit);
......@@ -152,6 +156,50 @@ class VisitorProfile
return $this->isEcommerceEnabled;
}
/**
* @param $action
*/
private function handleIfEventAction($action)
{
if ($action['type'] != 'event') {
return;
}
$this->profile['totalEvents']++;
}
/**
* @param $action
*/
private function handleIfDownloadAction($action)
{
if ($action['type'] != 'download') {
return;
}
$this->profile['totalDownloads']++;
}
/**
* @param $action
*/
private function handleIfOutlinkAction($action)
{
if ($action['type'] != 'outlink') {
return;
}
$this->profile['totalOutlinks']++;
}
/**
* @param $action
*/
private function handleIfPageViewAction($action)
{
if ($action['type'] != 'action') {
return;
}
$this->profile['totalPageViews']++;
}
/**
* @param $action
*/
......@@ -283,7 +331,11 @@ class VisitorProfile
$this->profile['totalVisits'] = 0;
$this->profile['totalVisitDuration'] = 0;
$this->profile['totalActions'] = 0;
$this->profile['totalEvents'] = 0;
$this->profile['totalOutlinks'] = 0;
$this->profile['totalDownloads'] = 0;
$this->profile['totalSearches'] = 0;
$this->profile['totalPageViews'] = 0;
$this->profile['totalPageViewsWithTiming'] = 0;
$this->profile['totalGoalConversions'] = 0;
$this->profile['totalConversionsByGoal'] = array();
......
......@@ -36,6 +36,7 @@
"VisitorsLastVisit": "This visitor's last visit was %s days ago.",
"VisitsFrom": "%1$s%2$s visits%3$s from",
"VisitSummary": "Spent a total of %1$s%2$s on the website%3$s, and %4$sviewed %5$s pages in %6$s visits.%7$s",
"VisitSummaryWithActionDetails": "Spent a total of %1$s%2$s on the website%3$s, and %4$sperformed %5$s actions (%6$s) in %7$s visits.%8$s",
"RowActionTooltipDefault": "Show Visitor Log segmented by this row",
"RowActionTooltipWithDimension": "Show Visitor Log segmented by this %s",
"RowActionTooltipTitle": "Open segmented Visitor Log",
......
......@@ -40,7 +40,17 @@
<div class="visitor-profile-summary">
<h1>{{ 'General_Summary'|translate }}</h1>
<div>
<p>{{ 'Live_VisitSummary'|translate('<strong>' ~ visitorData.totalVisitDurationPretty ~ '</strong>', '', '', '<strong>', visitorData.totalActions, visitorData.totalVisits, '</strong>')|raw }}</p>
{% if visitorData.totalPageViews != visitorData.totalActions %}
{% set actionDetails = [] %}
{% if visitorData.totalPageViews > 0 %}{% set actionDetails = actionDetails|merge([visitorData.totalPageViews ~ ' ' ~ 'General_ColumnPageviews'|translate]) %}{% endif %}
{% if visitorData.totalEvents > 0 %}{% set actionDetails = actionDetails|merge([visitorData.totalEvents ~ ' ' ~ 'Events_Events'|translate]) %}{% endif %}
{% if visitorData.totalDownloads > 0 %}{% set actionDetails = actionDetails|merge([visitorData.totalDownloads ~ ' ' ~ 'General_Downloads'|translate]) %}{% endif %}
{% if visitorData.totalOutlinks > 0 %}{% set actionDetails = actionDetails|merge([visitorData.totalOutlinks ~ ' ' ~ 'General_Outlinks'|translate]) %}{% endif %}
{% if visitorData.totalSearches > 0 %}{% set actionDetails = actionDetails|merge([visitorData.totalSearches ~ ' ' ~ 'Actions_ColumnSearches'|translate]) %}{% endif %}
<p>{{ 'Live_VisitSummaryWithActionDetails'|translate('<strong>' ~ visitorData.totalVisitDurationPretty ~ '</strong>', '', '', '<strong>', visitorData.totalActions, actionDetails|join(', ') , visitorData.totalVisits, '</strong>')|raw }}</p>
{% else %}
<p>{{ 'Live_VisitSummary'|translate('<strong>' ~ visitorData.totalVisitDurationPretty ~ '</strong>', '', '', '<strong>', visitorData.totalActions, visitorData.totalVisits, '</strong>')|raw }}</p>
{% endif %}
<p>{% if visitorData.totalGoalConversions %}<strong>{% endif %}{{ 'Live_ConvertedNGoals'|translate(visitorData.totalGoalConversions) }}{% if visitorData.totalGoalConversions %}</strong>{% endif %}
{%- if visitorData.totalGoalConversions %} (
{%- for idGoal, totalConversions in visitorData.totalConversionsByGoal -%}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter