Commit 45aa4e58708ad67e48bfcbd02c761726a393c617
1 parent
5776b7c8
ga
Showing
1 changed file
with
15 additions
and
14 deletions
Show diff stats
backend/views/report/index.php
... | ... | @@ -45,20 +45,7 @@ if (isset($_SESSION['access_token']) && $_SESSION['access_token']) { |
45 | 45 | // Вывод ответа. |
46 | 46 | printResults($response); |
47 | 47 | |
48 | - private function queryCoreReportingApi() { | |
49 | - $optParams = array( | |
50 | - 'dimensions' => 'ga:source,ga:keyword', | |
51 | - 'sort' => '-ga:sessions,ga:source', | |
52 | - 'filters' => 'ga:medium==organic', | |
53 | - 'max-results' => '25'); | |
54 | - | |
55 | - return $service->data_ga->get( | |
56 | - TABLE_ID, | |
57 | - '2010-01-01', | |
58 | - '2010-01-15', | |
59 | - 'ga:sessions', | |
60 | - $optParams); | |
61 | - } | |
48 | + | |
62 | 49 | try { |
63 | 50 | $results = queryCoreReportingApi(); |
64 | 51 | // Success. Do something cool! |
... | ... | @@ -130,5 +117,19 @@ function printResults($reports) { |
130 | 117 | } |
131 | 118 | } |
132 | 119 | |
120 | +function queryCoreReportingApi() { | |
121 | + $optParams = array( | |
122 | + 'dimensions' => 'ga:source,ga:keyword', | |
123 | + 'sort' => '-ga:sessions,ga:source', | |
124 | + 'filters' => 'ga:medium==organic', | |
125 | + 'max-results' => '25'); | |
126 | + | |
127 | + return $service->data_ga->get( | |
128 | + TABLE_ID, | |
129 | + '2010-01-01', | |
130 | + '2010-01-15', | |
131 | + 'ga:sessions', | |
132 | + $optParams); | |
133 | +} | |
133 | 134 | |
134 | 135 | ... | ... |