Piwik\DataTable\Filter\

AddColumnsProcessedMetricsGoal

Adds goal related metrics to a DataTable using metrics that already exist.

Metrics added are:

  • revenue_per_visit: total goal and ecommerce revenue / nb_visits
  • goal_%idGoal%_conversion_rate: the conversion rate. There will be one of these columns for each goal that exists for the site.
  • goal_%idGoal%_nb_conversions: the number of conversions. There will be one of these columns for each goal that exists for the site.
  • goal_%idGoal%_revenue_per_visit: goal revenue / nb_visits. There will be one of these columns for each goal that exists for the site.
  • goal_%idGoal%_revenue: goal revenue. There will be one of these columns for each goal that exists for the site.
  • goal_%idGoal%_avg_order_revenue: goal revenue / number of orders or abandoned carts. Only for ecommerce order and abandoned cart reports.
  • goal_%idGoal%_items: number of items. Only for ecommerce order and abandoned cart reports.

Adding the filter_update_columns_when_show_all_goals 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('AddColumnsProcessedMetricsGoal',
    array($enable = true, $idGoal = Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER));

Methods

The class defines the following methods:

__construct()

Constructor.

Signature

  • It accepts the following parameter(s):

    • $table (DataTable) —

    • $enable

    • $processOnlyIdGoal

    • $goalsToProcess

filter()

Adds the processed metrics. See AddColumnsProcessedMetrics for more information.

Signature

  • It accepts the following parameter(s):

  • 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.

getProcessOnlyIdGoalToUseForReport()

Returns an idGoal override to use for the processOnlyIdGoal parameter of this filter if $requestMethod is for a Actions page report or an Actions entry page report.

Signature

  • It accepts the following parameter(s):

    • $idGoal

    • $requestMethod (string) —

  • Returns: int|string|null