public function render() { $accountId = ACCOUNT_ID; $optParams = array('tree' => true); // Retrieve account with sub accounts. $account = $this->adSenseService->accounts->get($accountId, $optParams); $data = array(); $this->buildTree($account, &$data, null); $data = json_encode($data); $columns = array(array('string', 'Account ID'), array('string', 'Parent'), array('number', 'Weight')); $type = 'TreeMap'; $options = json_encode(array('title' => 'Account treemap')); print generateChartHtml($data, $columns, $type, $options); }
public function render() { $startDate = $this->getSixMonthsBeforeNow(); $endDate = $this->getNow(); $optParams = array('metric' => array('AD_REQUESTS'), 'dimension' => array('AD_CLIENT_ID'), 'sort' => 'AD_CLIENT_ID'); // Retrieve report. $report = $this->adSenseService->reports->generate($startDate, $endDate, $optParams); $data = $report['rows']; // We need to convert the metrics to numeric values for the chart. foreach ($data as &$row) { $row[1] = (int) $row[1]; } $data = json_encode($data); $columns = array(array('string', 'Ad client id'), array('number', 'Ad requests')); $type = 'PieChart'; $options = json_encode(array('title' => 'Ads requests per ad client id')); print generateChartHtml($data, $columns, $type, $options); }
public function render() { $startDate = $this->getSixMonthsBeforeNow(); $endDate = $this->getNow(); $optParams = array('metric' => array('PAGE_VIEWS'), 'dimension' => array('COUNTRY_NAME'), 'sort' => 'COUNTRY_NAME'); // Retrieve report. $report = $this->adSenseService->reports->generate($startDate, $endDate, $optParams); $data = $report['rows']; // We need to convert the metrics to numeric values for the chart. foreach ($data as &$row) { $row[1] = (int) $row[1]; } $data = json_encode($data); $columns = array(array('string', 'Country name'), array('number', 'Page views')); $type = 'GeoChart'; $options = json_encode(array()); print generateChartHtml($data, $columns, $type, $options); }
public function render() { $startDate = $this->getSixMonthsBeforeNow(); $endDate = $this->getNow(); $optParams = array('metric' => array('AD_REQUESTS', 'MATCHED_AD_REQUESTS', 'INDIVIDUAL_AD_IMPRESSIONS'), 'dimension' => array('AD_CLIENT_ID'), 'sort' => 'AD_CLIENT_ID'); // Retrieve report. $report = $this->adSenseService->reports->generate($startDate, $endDate, $optParams); $data = $report['rows']; // We need to convert the metrics to numeric values for the chart. foreach ($data as &$row) { $row[1] = (int) $row[1]; $row[2] = (int) $row[2]; $row[3] = (int) $row[3]; } $data = json_encode($data); $columns = array(array('string', 'Ad client id'), array('number', 'Ad requests'), array('number', 'Matched ad requests'), array('number', 'Individual ad impressions')); $type = 'Table'; $options = json_encode(array()); print generateChartHtml($data, $columns, $type, $options); }