AddColumnsProcessedMetrics
Click here if you want to read this article for the latest version.
Piwik\DataTable\Filter\
AddColumnsProcessedMetrics
Adds processed metrics columns to a DataTable using metrics that already exist.
Columns added are:
- conversion_rate: percent value of `nb_visits_converted / nb_visits
- nb_actions_per_visit:
nb_actions / nb_visits - avg_time_on_site: in number of seconds,
round(visit_length / nb_visits). Not pretty formatted. - bounce_rate: percent value of
bounce_count / nb_visits
Adding the filter_add_columns_when_show_all_columns query parameter to an API request will trigger the execution of this Filter.
Note: This filter must be called before ReplaceColumnNames is called.
Basic usage example
$dataTable->filter('AddColumnsProcessedMetrics');
Methods
The class defines the following methods:
__construct()— Constructor.filter()— Adds the processed metrics.enableRecursive()ash; Enables/Disables recursive filtering. Inherited fromBaseFilterfilterSubTable()ash; Filters a row's subtable, if one exists and is loaded in memory. Inherited fromBaseFilter
__construct()
Constructor.
Signature
It accepts the following parameter(s):
$table(DataTable) —$deleteRowsWithNoVisit(bool) — Whether to delete rows with no visits or not.
filter()
Adds the processed metrics. See AddColumnsProcessedMetrics for more information.
Signature
It accepts the following parameter(s):
$table(DataTable) —
It does not return anything or a mixed result.
enableRecursive()
Enables/Disables recursive filtering. Whether this property is actually used is up to the derived BaseFilter class.
Signature
It accepts the following parameter(s):
$enable(bool) —
It does not return anything or a mixed result.
filterSubTable()
Filters a row's subtable, if one exists and is loaded in memory.
Signature
- It accepts the following parameter(s):
$row(Row) — The row whose subtable should be filter.
- It does not return anything or a mixed result.