Piwik\
This class contains metadata regarding core metrics and contains several related helper functions.
Of note are the INDEX_...
constants. In the database, metric column names
in DataTable rows are stored as integers to save space. The integer
values used are determined by these constants.
This class defines the following properties:
$mappingFromIdToName
$mappingFromIdToNameGoal
The class defines the following methods:
getMappingFromIdToName()
getVisitsMetricNames()
getMappingFromNameToId()
getMappingFromNameToIdGoal()
getDefaultMetricSemanticTypes()
getDefaultMetricTranslations()
getDefaultMetrics()
getDefaultProcessedMetrics()
getReadableColumnName()
getMetricIdsToProcessReportTotal()
getDefaultMetricsDocumentation()
getPercentVisitColumn()
makeGoalColumnsRow()
— This is a utility method used when building records through log aggregation.getMappingFromIdToName()
getVisitsMetricNames()
getMappingFromNameToId()
getMappingFromNameToIdGoal()
getDefaultMetricSemanticTypes()
array
value.getDefaultMetricTranslations()
getDefaultMetrics()
getDefaultProcessedMetrics()
getReadableColumnName()
It accepts the following parameter(s):
$columnIdRaw
It does not return anything or a mixed result.
getMetricIdsToProcessReportTotal()
getDefaultMetricsDocumentation()
getPercentVisitColumn()
makeGoalColumnsRow()
This is a utility method used when building records through log aggregation.
In records with per-goal conversion metrics the metrics are stored within DataTable Rows
as a column with an array a value. The array is indexed by the goal ID and the column name
is set to Metrics::INDEX_GOALS
, for example:
$columns = [
Metrics::INDEX_GOALS = [
$idGoal => [
// ... conversion metrics ...
],
],
];
$row = new Row([DataTable::COLUMNS => $columns]);
This methods returns an array like $columns
above based on a goal ID and a row of
metric values for the goal. The result can be added directly to a DataTable record via sumRowWithLabel()
.
The goal metrics returned will differ based on whether the goal is user defined or an ecommerce goal.
It accepts the following parameter(s):
$idGoal
(int
) —
$goalsMetrics
(array
) —
It returns a array
value.