public function getPercentMetricsToFormat() { return array('bounce_rate', 'conversion_rate', 'abandoned_rate', 'interaction_rate', 'exit_rate', 'bounce_rate_returning', 'nb_visits_percentage', '/.*_evolution/', '/goal_.*_conversion_rate/'); }
/** * @param DataTableInterface $dataTable * @return DataTableInterface */ public function applyMetricsFormatting($dataTable) { $formatMetrics = Common::getRequestVar('format_metrics', 0, 'string', $this->request); if ($formatMetrics == '0') { return $dataTable; } // in Piwik 2.X & below, metrics are not formatted in API responses except for percents. // this code implements this inconsistency $onlyFormatPercents = $formatMetrics === 'bc'; $metricsToFormat = null; if ($onlyFormatPercents) { $metricsToFormat = $this->apiInconsistencies->getPercentMetricsToFormat(); } $dataTable->filter(array($this->formatter, 'formatMetrics'), array($this->report, $metricsToFormat)); return $dataTable; }