diff --git a/app/library/App/Controllers/GaController.php b/app/library/App/Controllers/GaController.php index d8070c0..d34985a 100644 --- a/app/library/App/Controllers/GaController.php +++ b/app/library/App/Controllers/GaController.php @@ -25,13 +25,15 @@ class GaController extends CrudResourceController { public function getAction() { + $metric = $this->request->getServer('metric'); + putenv('GOOGLE_APPLICATION_CREDENTIALS=/var/www/phalcon/'.self::SECRET_JSON); $client = new Google_Client(); $client->useApplicationDefaultCredentials(); $client->setScopes(['https://www.googleapis.com/auth/analytics.readonly']); $analytics = new Google_Service_AnalyticsReporting($client); - $param[] = ['metric' => 'ga:sessions', 'alias' => 'Сессии']; + $param[] = ['metric' => $metric]; $response = []; @@ -45,7 +47,7 @@ class GaController extends CrudResourceController { // Создание объекта Metrics. $sessions = new Google_Service_AnalyticsReporting_Metric(); $sessions->setExpression($item['metric']); - $sessions->setAlias($item['alias']); + //$sessions->setAlias($item['alias']); // Создание объекта ReportRequest. -- libgit2 0.21.4