'addComputedMetrics' ); return $hooks; } public function addComputedMetrics(MetricsList $list, ComputedMetricFactory $computedMetricFactory) { $category = 'Goals_Ecommerce'; $metrics = $list->getMetrics(); foreach ($metrics as $metric) { if ($metric instanceof ArchivedMetric && $metric->getDimension()) { $metricName = $metric->getName(); if ($metric->getDbTableName() === 'log_conversion' && $metricName !== 'nb_uniq_orders' && strpos($metricName, ArchivedMetric::AGGREGATION_SUM_PREFIX) === 0 && $metric->getCategoryId() === $category) { $metric = $computedMetricFactory->createComputedMetric($metric->getName(), 'nb_uniq_orders', ComputedMetric::AGGREGATION_AVG); $list->addMetric($metric); } } } } }