Commit d6c4c133df13bb19b716b3c8ac74a2cd8c94d96a
1 parent
ff25157e
ga response
Showing
1 changed file
with
4 additions
and
2 deletions
Show diff stats
app/library/App/Controllers/GaController.php
| ... | ... | @@ -25,13 +25,15 @@ class GaController extends CrudResourceController { |
| 25 | 25 | |
| 26 | 26 | public function getAction() { |
| 27 | 27 | |
| 28 | + $metric = $this->request->getServer('metric'); | |
| 29 | + | |
| 28 | 30 | putenv('GOOGLE_APPLICATION_CREDENTIALS=/var/www/phalcon/'.self::SECRET_JSON); |
| 29 | 31 | $client = new Google_Client(); |
| 30 | 32 | $client->useApplicationDefaultCredentials(); |
| 31 | 33 | $client->setScopes(['https://www.googleapis.com/auth/analytics.readonly']); |
| 32 | 34 | $analytics = new Google_Service_AnalyticsReporting($client); |
| 33 | 35 | |
| 34 | - $param[] = ['metric' => 'ga:sessions', 'alias' => 'Сессии']; | |
| 36 | + $param[] = ['metric' => $metric]; | |
| 35 | 37 | |
| 36 | 38 | $response = []; |
| 37 | 39 | |
| ... | ... | @@ -45,7 +47,7 @@ class GaController extends CrudResourceController { |
| 45 | 47 | // Создание объекта Metrics. |
| 46 | 48 | $sessions = new Google_Service_AnalyticsReporting_Metric(); |
| 47 | 49 | $sessions->setExpression($item['metric']); |
| 48 | - $sessions->setAlias($item['alias']); | |
| 50 | + //$sessions->setAlias($item['alias']); | |
| 49 | 51 | |
| 50 | 52 | |
| 51 | 53 | // Создание объекта ReportRequest. | ... | ... |