Backend\Modules\Analytics\GoogleClient\Connector::collectSourceGraphData PHP Method

collectSourceGraphData() private method

Fetches the data needed to build the source graph for a date range
private collectSourceGraphData ( integer $startDate, integer $endDate ) : array
$startDate integer
$endDate integer
return array
    private function collectSourceGraphData($startDate, $endDate)
    {
        $sourceGraphData = $this->getAnalyticsData($startDate, $endDate, 'ga:pageviews', array('dimensions' => 'ga:medium', 'sort' => '-ga:pageviews'));
        // make sure our column headers are the metric names, not just numbers
        $namedRows = array();
        foreach ((array) $sourceGraphData['rows'] as $dataRow) {
            $namedRow = array();
            foreach ($dataRow as $key => $value) {
                $headerName = $sourceGraphData['columnHeaders'][$key]['name'];
                $namedRow[str_replace(':', '_', $headerName)] = $value;
            }
            $namedRows[] = $namedRow;
        }
        return $namedRows;
    }