diff --git a/backend/views/report/index.php b/backend/views/report/index.php index d503802..2d28cf5 100644 --- a/backend/views/report/index.php +++ b/backend/views/report/index.php @@ -45,20 +45,7 @@ if (isset($_SESSION['access_token']) && $_SESSION['access_token']) { // Вывод ответа. printResults($response); - private function queryCoreReportingApi() { - $optParams = array( - 'dimensions' => 'ga:source,ga:keyword', - 'sort' => '-ga:sessions,ga:source', - 'filters' => 'ga:medium==organic', - 'max-results' => '25'); - - return $service->data_ga->get( - TABLE_ID, - '2010-01-01', - '2010-01-15', - 'ga:sessions', - $optParams); - } + try { $results = queryCoreReportingApi(); // Success. Do something cool! @@ -130,5 +117,19 @@ function printResults($reports) { } } +function queryCoreReportingApi() { + $optParams = array( + 'dimensions' => 'ga:source,ga:keyword', + 'sort' => '-ga:sessions,ga:source', + 'filters' => 'ga:medium==organic', + 'max-results' => '25'); + + return $service->data_ga->get( + TABLE_ID, + '2010-01-01', + '2010-01-15', + 'ga:sessions', + $optParams); +} -- libgit2 0.21.4