Commit 0bf4040a1f7bebb9202536387c76f2073de89c2e

Authored by Alex Savenko
1 parent a237d50f

dimensions +dynamics +multiple

Showing 1 changed file with 4 additions and 6 deletions   Show diff stats
app/library/App/Controllers/GaController.php
@@ -53,22 +53,20 @@ class GaController extends CrudResourceController { @@ -53,22 +53,20 @@ class GaController extends CrudResourceController {
53 } 53 }
54 54
55 //Create the Dimensions object. 55 //Create the Dimensions object.
56 - $dimension = [];  
57 - //$get_dimensions = explode(',', $get_dimensions);  
58 - $get_dimensions = ['browser']; 56 + $dimensions = [];
  57 + $get_dimensions = explode(',', $get_dimensions);
59 foreach ($get_dimensions as $dimension) { 58 foreach ($get_dimensions as $dimension) {
60 $dimension_obj = new Google_Service_AnalyticsReporting_Dimension(); 59 $dimension_obj = new Google_Service_AnalyticsReporting_Dimension();
61 $dimension_obj->setName("ga:".$dimension); 60 $dimension_obj->setName("ga:".$dimension);
62 - $dimension[] = $dimension_obj; 61 + $dimensions[] = $dimension_obj;
63 } 62 }
64 - return $dimension;  
65 63
66 64
67 // Создание объекта ReportRequest. 65 // Создание объекта ReportRequest.
68 $request = new Google_Service_AnalyticsReporting_ReportRequest(); 66 $request = new Google_Service_AnalyticsReporting_ReportRequest();
69 $request->setViewId(self::VIEW_ID); 67 $request->setViewId(self::VIEW_ID);
70 $request->setDateRanges($dateRange); 68 $request->setDateRanges($dateRange);
71 - $request->setDimensions(array($dimension)); 69 + $request->setDimensions(array($dimensions));
72 $request->setMetrics(array($metrics)); 70 $request->setMetrics(array($metrics));
73 71
74 $body = new Google_Service_AnalyticsReporting_GetReportsRequest(); 72 $body = new Google_Service_AnalyticsReporting_GetReportsRequest();