Commit 78bfe34131139bed280ecd87694289fe2f4c47df
1 parent
843214bf
test google lib
Showing
1 changed file
with
0 additions
and
25 deletions
Show diff stats
app/library/App/Bootstrap/RouteBootstrap.php
| @@ -79,30 +79,5 @@ class RouteBootstrap implements BootstrapInterface | @@ -79,30 +79,5 @@ class RouteBootstrap implements BootstrapInterface | ||
| 79 | }); | 79 | }); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | - function getReport($analytics, $metric, $alias) { | ||
| 83 | 82 | ||
| 84 | - // Замена на свой идентификатор представления, напр. XXXX. | ||
| 85 | - $VIEW_ID = "119240817"; | ||
| 86 | - | ||
| 87 | - // Создание объекта DateRange. | ||
| 88 | - $dateRange = new Google_Service_AnalyticsReporting_DateRange(); | ||
| 89 | - $dateRange->setStartDate("30daysAgo"); | ||
| 90 | - $dateRange->setEndDate("today"); | ||
| 91 | - | ||
| 92 | - // Создание объекта Metrics. | ||
| 93 | - $sessions = new Google_Service_AnalyticsReporting_Metric(); | ||
| 94 | - $sessions->setExpression($metric); | ||
| 95 | - $sessions->setAlias($alias); | ||
| 96 | - | ||
| 97 | - | ||
| 98 | - // Создание объекта ReportRequest. | ||
| 99 | - $request = new Google_Service_AnalyticsReporting_ReportRequest(); | ||
| 100 | - $request->setViewId($VIEW_ID); | ||
| 101 | - $request->setDateRanges($dateRange); | ||
| 102 | - $request->setMetrics(array($sessions)); | ||
| 103 | - | ||
| 104 | - $body = new Google_Service_AnalyticsReporting_GetReportsRequest(); | ||
| 105 | - $body->setReportRequests( array( $request) ); | ||
| 106 | - return $analytics->reports->batchGet( $body ); | ||
| 107 | - } | ||
| 108 | } | 83 | } |
| 109 | \ No newline at end of file | 84 | \ No newline at end of file |