diff --git a/backend/views/report/index.php b/backend/views/report/index.php index ed6a497..3dc5fb6 100644 --- a/backend/views/report/index.php +++ b/backend/views/report/index.php @@ -40,17 +40,18 @@ if (isset($_SESSION['access_token']) && $_SESSION['access_token']) { $analytics = new Google_Service_AnalyticsReporting($client); // Вызов the Analytics Reporting API V4. - $metric_1 = 'ga:sessions'; - $metric_2 = 'ga:users'; - $metric_3 = 'ga:CTR'; - $response_1 = getReport($analytics, $metric_1); - $response_2 = getReport($analytics, $metric_2); - $response_3 = getReport($analytics, $metric_3); - - // Вывод ответа. - printResults($response_1); - printResults($response_2); - printResults($response_3); + + $param[] = ['metric' => 'ga:sessions', 'alias' => 'Сессии']; + $param[] = ['metric' => 'ga:users', 'alias' => 'Пользователи']; + $param[] = ['metric' => 'ga:CTR', 'alias' => 'CTR']; + + foreach ($param as $item) { + $response = getReport($analytics, $item['metric'], $item['alias']); + + // Вывод ответа. + printResults($response); + } + } else { -- libgit2 0.21.4