getMetric($row, 'price'); $orders = $this->getMetric($row, 'orders'); $abandonedCarts = $this->getMetric($row, 'abandoned_carts'); return Piwik::getQuotientSafe($price, $orders === false ? $abandonedCarts : $orders, GoalManager::REVENUE_PRECISION); } public function getDependentMetrics() { return array('price', 'orders', 'abandoned_carts'); } public function format($value, Formatter $formatter) { return $formatter->getPrettyMoney($value, $this->idSite); } public function beforeFormat($report, DataTable $table) { $this->idSite = DataTableFactory::getSiteIdFromMetadata($table); return !empty($this->idSite); // skip formatting if there is no site to get currency info from } }