Piwik\

Metrics

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.

Properties

This class defines the following properties:

$mappingFromIdToName

Signature

  • Its type is not specified.

$mappingFromIdToNameGoal

Signature

  • Its type is not specified.

Methods

The class defines the following methods:

getMappingFromIdToName()

Signature

  • It does not return anything or a mixed result.

getVisitsMetricNames()

Signature

  • It does not return anything or a mixed result.

getMappingFromNameToId()

Signature

  • It does not return anything or a mixed result.

getMappingFromNameToIdGoal()

Signature

  • It does not return anything or a mixed result.

getDefaultMetricSemanticTypes()

Signature

  • It returns a array value.

getDefaultMetricTranslations()

Signature

  • It does not return anything or a mixed result.

getDefaultMetrics()

Signature

  • It does not return anything or a mixed result.

getDefaultProcessedMetrics()

Signature

  • It does not return anything or a mixed result.

getReadableColumnName()

Signature

  • It accepts the following parameter(s):

    • $columnIdRaw
  • It does not return anything or a mixed result.

getMetricIdsToProcessReportTotal()

Signature

  • It does not return anything or a mixed result.

getDefaultMetricsDocumentation()

Signature

  • It does not return anything or a mixed result.

getPercentVisitColumn()

Signature

  • It does not return anything or a mixed result.

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.

Signature

  • It accepts the following parameter(s):

    • $idGoal (int) —

    • $goalsMetrics (array) —

  • It returns a array value.