Commit 39ed17fca920889eed751287955939fa910c0c3e
1 parent
dc1bb62d
test google lib
Showing
1 changed file
with
17 additions
and
1 deletions
Show diff stats
app/library/App/Bootstrap/RouteBootstrap.php
@@ -52,9 +52,17 @@ class RouteBootstrap implements BootstrapInterface | @@ -52,9 +52,17 @@ class RouteBootstrap implements BootstrapInterface | ||
52 | $client->setDeveloperKey($api_key); | 52 | $client->setDeveloperKey($api_key); |
53 | $analytics = new Google_Service_AnalyticsReporting($client); | 53 | $analytics = new Google_Service_AnalyticsReporting($client); |
54 | 54 | ||
55 | + $param[] = ['metric' => 'ga:sessions', 'alias' => 'Сессии']; | ||
56 | + $param[] = ['metric' => 'ga:users', 'alias' => 'Пользователи']; | ||
57 | + $param[] = ['metric' => 'ga:CTR', 'alias' => 'CTR']; | ||
58 | + $param[] = ['metric' => 'ga:goal1Value', 'alias' => 'цель "Корзина"']; | ||
55 | 59 | ||
60 | + foreach ($param as $item) { | ||
61 | + $response = getReport($analytics, $item['metric'], $item['alias']); | ||
56 | 62 | ||
57 | - $var_2 = var_dump($analytics); | 63 | + } |
64 | + | ||
65 | + $var_2 = var_dump($response); | ||
58 | 66 | ||
59 | $msg = "testing fine"; | 67 | $msg = "testing fine"; |
60 | 68 | ||
@@ -64,4 +72,12 @@ class RouteBootstrap implements BootstrapInterface | @@ -64,4 +72,12 @@ class RouteBootstrap implements BootstrapInterface | ||
64 | ]); | 72 | ]); |
65 | }); | 73 | }); |
66 | } | 74 | } |
75 | + | ||
76 | + public function getReport($analytics, $metric, $alias) { | ||
77 | + | ||
78 | + // Замена на свой идентификатор представления, напр. XXXX. | ||
79 | + $VIEW_ID = "119240817"; | ||
80 | + | ||
81 | + return $VIEW_ID; | ||
82 | + } | ||
67 | } | 83 | } |
68 | \ No newline at end of file | 84 | \ No newline at end of file |