Piwik\Plugins\Goals\Goals::getReportMetadataEnd PHP Method

getReportMetadataEnd() public method

The API returns general Goal metrics: conv, conv rate and revenue globally and for each goal. Also, this will update metadata of all other reports that have Goal segmentation
public getReportMetadataEnd ( &$reports, $info )
    public function getReportMetadataEnd(&$reports, $info)
    {
        // Processed in AddColumnsProcessedMetricsGoal
        // These metrics will also be available for some reports, for each goal
        // Example: Conversion rate for Goal 2 for the keyword 'piwik'
        $goalProcessedMetrics = array('revenue_per_visit' => Piwik::translate('General_ColumnValuePerVisit'));
        $goalMetrics = array('nb_conversions' => Piwik::translate('Goals_ColumnConversions'), 'conversion_rate' => Piwik::translate('General_ColumnConversionRate'), 'revenue' => Piwik::translate('General_ColumnRevenue'));
        $reportsWithGoals = self::getAllReportsWithGoalMetrics();
        foreach ($reportsWithGoals as $reportWithGoals) {
            // Select this report from the API metadata array
            // and add the Goal metrics to it
            foreach ($reports as &$apiReportToUpdate) {
                if ($apiReportToUpdate['module'] == $reportWithGoals['module'] && $apiReportToUpdate['action'] == $reportWithGoals['action'] && empty($apiReportToUpdate['parameters'])) {
                    $apiReportToUpdate['metricsGoal'] = $goalMetrics;
                    $apiReportToUpdate['processedMetricsGoal'] = $goalProcessedMetrics;
                    break;
                }
            }
        }
    }