Commit c5aa2e2b6111949703bf752e63d0be3ab19d2b9b
1 parent
f51dd710
dimensions +dynamics +multiple
Showing
1 changed file
with
5 additions
and
5 deletions
Show diff stats
app/library/App/Controllers/GaController.php
| ... | ... | @@ -28,7 +28,7 @@ class GaController extends CrudResourceController { |
| 28 | 28 | $get_metrics = $this->request->get('metric') ?? 'users'; |
| 29 | 29 | $get_start_date = $this->request->get('start') ?? '30daysAgo'; |
| 30 | 30 | $get_end_date = $this->request->get('end') ?? 'today'; |
| 31 | - $get_dimension = $this->request->get('dimension') ?? 'browser'; | |
| 31 | + $get_dimensions = $this->request->get('dimension') ?? 'browser'; | |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | putenv('GOOGLE_APPLICATION_CREDENTIALS=/var/www/phalcon/'.self::SECRET_JSON); |
| ... | ... | @@ -54,10 +54,10 @@ class GaController extends CrudResourceController { |
| 54 | 54 | |
| 55 | 55 | //Create the Dimensions object. |
| 56 | 56 | $dimension = []; |
| 57 | - $get_dimension = explode(',', $get_dimension); | |
| 58 | - foreach ($get_dimension as $dimension) { | |
| 57 | + $get_dimensions = explode(',', $get_dimensions); | |
| 58 | + foreach ($get_dimensions as $dimension) { | |
| 59 | 59 | $dimension_obj = new Google_Service_AnalyticsReporting_Dimension(); |
| 60 | - $dimension_obj->setName("ga:".$get_dimension); | |
| 60 | + $dimension_obj->setName("ga:".$get_dimensions); | |
| 61 | 61 | $dimension[] = $dimension_obj; |
| 62 | 62 | } |
| 63 | 63 | |
| ... | ... | @@ -66,8 +66,8 @@ class GaController extends CrudResourceController { |
| 66 | 66 | $request = new Google_Service_AnalyticsReporting_ReportRequest(); |
| 67 | 67 | $request->setViewId(self::VIEW_ID); |
| 68 | 68 | $request->setDateRanges($dateRange); |
| 69 | - $request->setMetrics(array($metrics)); | |
| 70 | 69 | $request->setDimensions(array($dimension)); |
| 70 | + $request->setMetrics(array($metrics)); | |
| 71 | 71 | |
| 72 | 72 | $body = new Google_Service_AnalyticsReporting_GetReportsRequest(); |
| 73 | 73 | $body->setReportRequests( array( $request) ); | ... | ... |