diff --git a/app/library/App/Controllers/GaController.php b/app/library/App/Controllers/GaController.php index 107e14d..47adcb1 100644 --- a/app/library/App/Controllers/GaController.php +++ b/app/library/App/Controllers/GaController.php @@ -25,7 +25,7 @@ class GaController extends CrudResourceController { public function getAction() { - $metric = $this->request->get('metric'); + $getMetric = $this->request->get('metric'); putenv('GOOGLE_APPLICATION_CREDENTIALS=/var/www/phalcon/'.self::SECRET_JSON); $client = new Google_Client(); @@ -33,7 +33,7 @@ class GaController extends CrudResourceController { $client->setScopes(['https://www.googleapis.com/auth/analytics.readonly']); $analytics = new Google_Service_AnalyticsReporting($client); - $param[] = ['metric' => 'ga:'.$metric, 'alias' => 'alias']; + $param = ['metric' => 'ga:'.$getMetric]; $response = []; @@ -45,16 +45,16 @@ class GaController extends CrudResourceController { $dateRange->setEndDate("today"); // Создание объекта Metrics. - $sessions = new Google_Service_AnalyticsReporting_Metric(); - $sessions->setExpression($item['metric']); - $sessions->setAlias($item['alias']); + $metrics = new Google_Service_AnalyticsReporting_Metric(); + $metrics->setExpression($item['metric']); + //$sessions->setAlias($item['alias']); // Создание объекта ReportRequest. $request = new Google_Service_AnalyticsReporting_ReportRequest(); $request->setViewId(self::VIEW_ID); $request->setDateRanges($dateRange); - $request->setMetrics(array($sessions)); + $request->setMetrics(array($metrics)); $body = new Google_Service_AnalyticsReporting_GetReportsRequest(); $body->setReportRequests( array( $request) ); -- libgit2 0.21.4