Beispiel #1
0
 public static function __callstatic($callParams, $params)
 {
     $callParamsJson = $callParams;
     $callParams = json_decode($callParams);
     $gaParams = GaParams\GaParams::factory($callParamsJson);
     $params[0]['config'] = $params[0]['config']->toArray();
     $gaExport = GaExport::getInstance($params[0], $gaParams, $params[0]['config']['metrics']['options']);
     switch ($gaParams->method) {
         case 'visits':
             return $gaExport->visits();
             break;
         case 'event':
             return $gaExport->events();
             break;
         case 'pageview':
             return $gaExport->pageViews();
             break;
         case 'pageViewPath':
             return $gaExport->pageViewsPath();
             break;
         case 'custom':
             $f = $callParams->action;
             return static::$f($callParams, $params);
             break;
     }
     $method = $gaParams->method;
     return self::$method($params[0]);
 }
Beispiel #2
0
 /**
  * @param $callParams JSON
  * @param $startDate
  * @param $endDate
  * @return array|string
  * @throws \Exception
  */
 private function metricGet($callParams, $startDate, $endDate)
 {
     $gaParams = GaParams::factory($callParams);
     $gaExport = GaExport::getInstance(array('startTime' => $startDate, 'endTime' => $endDate, 'config' => App::$inst->config), $gaParams, $this->metricsConfig, true);
     switch ($gaParams->method) {
         case 'visits':
             return $gaExport->visits();
             break;
         case 'event':
             return $gaExport->events();
             break;
         case 'pageview':
             return $gaExport->pageViews();
             break;
         case 'pageViewPath':
             return $gaExport->pageViewsPath();
             break;
     }
 }