Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose goal sum metrics added to reports via EnrichRecordWithGoalMetricSums to report metadata. #22272

Open
wants to merge 11 commits into
base: 5.x-dev
Choose a base branch
from
Open
22 changes: 22 additions & 0 deletions core/Plugin/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,19 @@ class Report
*/
protected $hasGoalMetrics = false;

/**
* Set this property to true if your report supports goal metrics, but does not also include overall summed goal
* metrics (total conversions and total revenue across all goals).
*
* By default, Matomo assumes reports that set {@see self::$hasGoalMetrics} to `true` provide these overall
* metrics, but some reports are not able to compute them.
*
* Only used if {@see self::$hasGoalMetrics} is true.
* @var bool
* @api
*/
protected $hasGoalSumMetrics = true;

/**
* Set this property to false in case your report can't/shouldn't be flattened.
* In this case, flattener won't be applied even if parameter is provided in a request
Expand Down Expand Up @@ -593,6 +606,15 @@ public function hasGoalMetrics()
return $this->hasGoalMetrics;
}

/**
* @return bool
* @ignore
*/
public function hasGoalSumMetrics()
{
return $this->hasGoalSumMetrics;
}

/**
* @return bool
* @ignore
Expand Down
1 change: 1 addition & 0 deletions plugins/Actions/Reports/GetEntryPageTitles.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ protected function init()
$this->actionToLoadSubTables = $this->action;
$this->subcategoryId = 'Actions_SubmenuPagesEntry';
$this->hasGoalMetrics = true;
$this->hasGoalSumMetrics = false;
}

public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
Expand Down
1 change: 1 addition & 0 deletions plugins/Actions/Reports/GetEntryPageUrls.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ protected function init()
$this->actionToLoadSubTables = $this->action;
$this->subcategoryId = 'Actions_SubmenuPagesEntry';
$this->hasGoalMetrics = true;
$this->hasGoalSumMetrics = false;
}

public function getProcessedMetrics()
Expand Down
1 change: 1 addition & 0 deletions plugins/Actions/Reports/GetPageTitles.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ protected function init()
$this->actionToLoadSubTables = $this->action;
$this->subcategoryId = 'Actions_SubmenuPageTitles';
$this->hasGoalMetrics = true;
$this->hasGoalSumMetrics = false;
}

public function getMetrics()
Expand Down
1 change: 1 addition & 0 deletions plugins/Actions/Reports/GetPageUrls.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ protected function init()

$this->subcategoryId = 'General_Pages';
$this->hasGoalMetrics = true;
$this->hasGoalSumMetrics = false;
}

public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
Expand Down
3 changes: 2 additions & 1 deletion plugins/CustomDimensions/CustomDimensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public function getReportsWithGoalMetrics(&$reportsWithGoals)
'name' => $dimension['name'],
'module' => $this->pluginName,
'action' => 'getCustomDimension',
'parameters' => array('idDimension' => $dimension['idcustomdimension'])
'parameters' => array('idDimension' => $dimension['idcustomdimension']),
'hasGoalSumMetrics' => true,
);
}
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<nb_uniq_visitors>Unique visitors</nb_uniq_visitors>
<nb_actions>Actions</nb_actions>
<nb_users>Users</nb_users>
<nb_conversions>Conversions</nb_conversions>
<revenue>Revenue</revenue>
</metrics>
<metricsDocumentation>
<nb_visits>If a visitor comes to your website for the first time or if they visit a page more than 30 minutes after their last page view, this will be recorded as a new visit.</nb_visits>
Expand All @@ -25,6 +27,8 @@
<avg_time_on_site>The average duration of a visit.</avg_time_on_site>
<bounce_rate>The percentage of visits that only had a single pageview. This means, that the visitor left the website directly from the entrance page.</bounce_rate>
<conversion_rate>The percentage of visits that triggered a goal conversion.</conversion_rate>
<nb_conversions>The total number of conversions for all goals.</nb_conversions>
<revenue>The total revenue generated for all goals.</revenue>
</metricsDocumentation>
<processedMetrics>
<nb_actions_per_visit>Actions per Visit</nb_actions_per_visit>
Expand All @@ -40,6 +44,8 @@
<avg_time_on_site>duration_s</avg_time_on_site>
<bounce_rate>percent</bounce_rate>
<conversion_rate>percent</conversion_rate>
<nb_conversions>number</nb_conversions>
<revenue>money</revenue>
</metricTypes>
<constantRowsCount>1</constantRowsCount>
<metricsGoal>
Expand All @@ -64,10 +70,11 @@
<nb_uniq_visitors>Unique visitors</nb_uniq_visitors>
<nb_actions>Actions</nb_actions>
<nb_users>Users</nb_users>
<nb_conversions>Conversions</nb_conversions>
<revenue>Revenue</revenue>
<nb_actions_per_visit>Actions per Visit</nb_actions_per_visit>
<avg_time_on_site>Avg. Time on Website</avg_time_on_site>
<bounce_rate>Bounce Rate</bounce_rate>
<revenue>Revenue</revenue>
</columns>
<reportData>
<row>
Expand All @@ -76,6 +83,7 @@
<nb_visits>1</nb_visits>
<nb_actions>4</nb_actions>
<nb_users>0</nb_users>
<nb_conversions>1</nb_conversions>
<revenue>$10</revenue>
<nb_actions_per_visit>4</nb_actions_per_visit>
<avg_time_on_site>00:12:01</avg_time_on_site>
Expand All @@ -90,10 +98,12 @@
<nb_actions_per_visit>6</nb_actions_per_visit>
<avg_time_on_site>01:06:01</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
<label>02</label>
<nb_conversions>2</nb_conversions>
<revenue>$3,111.11</revenue>
<nb_visits>0</nb_visits>
<nb_actions_per_visit>0</nb_actions_per_visit>
Expand All @@ -112,6 +122,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -123,6 +134,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -134,6 +146,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -145,6 +158,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -153,6 +167,7 @@
<nb_visits>1</nb_visits>
<nb_actions>3</nb_actions>
<nb_users>0</nb_users>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
<nb_actions_per_visit>3</nb_actions_per_visit>
<avg_time_on_site>00:12:01</avg_time_on_site>
Expand All @@ -167,6 +182,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -178,6 +194,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -189,6 +206,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -200,6 +218,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -211,6 +230,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -222,6 +242,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -233,6 +254,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -244,6 +266,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -255,6 +278,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -266,6 +290,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -277,6 +302,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -288,6 +314,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -299,6 +326,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -310,6 +338,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -321,6 +350,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
<row>
Expand All @@ -332,6 +362,7 @@
<nb_actions_per_visit>0</nb_actions_per_visit>
<avg_time_on_site>00:00:00</avg_time_on_site>
<bounce_rate>0%</bounce_rate>
<nb_conversions>0</nb_conversions>
<revenue>$0</revenue>
</row>
</reportData>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<nb_visits>Visits</nb_visits>
<nb_uniq_visitors>Unique visitors</nb_uniq_visitors>
<nb_actions>Actions</nb_actions>
<nb_conversions>Conversions</nb_conversions>
<revenue>Revenue</revenue>
</metrics>
<metricsDocumentation>
<nb_visits>If a visitor comes to your website for the first time or if they visit a page more than 30 minutes after their last page view, this will be recorded as a new visit.</nb_visits>
Expand All @@ -23,6 +25,8 @@
<avg_time_on_site>The average duration of a visit.</avg_time_on_site>
<bounce_rate>The percentage of visits that only had a single pageview. This means, that the visitor left the website directly from the entrance page.</bounce_rate>
<conversion_rate>The percentage of visits that triggered a goal conversion.</conversion_rate>
<nb_conversions>The total number of conversions for all goals.</nb_conversions>
<revenue>The total revenue generated for all goals.</revenue>
</metricsDocumentation>
<processedMetrics>
<nb_actions_per_visit>Actions per Visit</nb_actions_per_visit>
Expand All @@ -37,6 +41,8 @@
<avg_time_on_site>duration_s</avg_time_on_site>
<bounce_rate>percent</bounce_rate>
<conversion_rate>percent</conversion_rate>
<nb_conversions>number</nb_conversions>
<revenue>money</revenue>
</metricTypes>
<metricsGoal>
<nb_conversions>Conversions</nb_conversions>
Expand All @@ -60,17 +66,19 @@
<nb_visits>Visits</nb_visits>
<nb_uniq_visitors>Unique visitors</nb_uniq_visitors>
<nb_actions>Actions</nb_actions>
<nb_conversions>Conversions</nb_conversions>
<revenue>Revenue</revenue>
<nb_actions_per_visit>Actions per Visit</nb_actions_per_visit>
<avg_time_on_site>Avg. Time on Website</avg_time_on_site>
<bounce_rate>Bounce Rate</bounce_rate>
<revenue>Revenue</revenue>
</columns>
<reportData>
<row>
<label>Poland</label>
<nb_uniq_visitors>1</nb_uniq_visitors>
<nb_visits>2</nb_visits>
<nb_actions>9</nb_actions>
<nb_conversions>2</nb_conversions>
<revenue>$3,111.11</revenue>
<nb_actions_per_visit>4.5</nb_actions_per_visit>
<avg_time_on_site>00:39:01</avg_time_on_site>
Expand All @@ -81,6 +89,7 @@
<nb_uniq_visitors>1</nb_uniq_visitors>
<nb_visits>1</nb_visits>
<nb_actions>4</nb_actions>
<nb_conversions>1</nb_conversions>
<revenue>$10</revenue>
<nb_actions_per_visit>4</nb_actions_per_visit>
<avg_time_on_site>00:12:01</avg_time_on_site>
Expand Down
Loading
Loading