|
@@ -293,10 +293,28 @@ class IndexController extends \app\controllers\HomeController
|
|
|
if(!$store){
|
|
|
$this->json(0,[],'参数错误');
|
|
|
}
|
|
|
+ $metricArr=[
|
|
|
+ 'pageviews'=>"ga:pageviews",
|
|
|
+ 'sessionCount'=>"ga:sessionCount",
|
|
|
+ 'users'=>"ga:users",
|
|
|
+ 'newUsers'=>"ga:newUsers",
|
|
|
+ 'bounceRate'=>"ga:bounceRate",
|
|
|
+ 'goal3Completions'=>"ga:goal3Completions",
|
|
|
+ 'goal3ConversionRate'=>"ga:goal3ConversionRate",
|
|
|
+ 'goal7Completions'=>"ga:goal7Completions",
|
|
|
+ 'goal7ConversionRate'=>"ga:goal7ConversionRate",
|
|
|
+ 'transactionRevenue'=>"ga:transactionRevenue",
|
|
|
+ 'revenuePerTransaction'=>"ga:revenuePerTransaction",
|
|
|
+ ];
|
|
|
$start_day=$request->get('start', date('Y-m-d',time()-3600*24));
|
|
|
$end_day = $request->get('end', date('Y-m-d',time()-3600*24));
|
|
|
- $goals=$ga->goals($store,$start_day,$end_day);
|
|
|
- $this->json(1,$goals);
|
|
|
+ $chunks=array_chunk($metricArr,10);
|
|
|
+ $data=[];
|
|
|
+ foreach($chunks as $arr){
|
|
|
+ $goals=$ga->goals($store,$arr,$start_day,$end_day);
|
|
|
+ $data=empty($goals)?$goals:array_merge_recursive($data,$goals);
|
|
|
+ }
|
|
|
+ $this->json(1,$data);
|
|
|
}
|
|
|
|
|
|
}
|