脚本宝典收集整理的这篇文章主要介绍了使用php获取谷歌分析实时数据,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
For screenviews after setting metrics and dimensions $metrics = 'ga:screenviews'; $optParams = array('dimensions' => 'ga:screenName'); $service = new GOOGLE_AnalyticsService($client); try { $result = $service->data_ga->get( $GA_VIEW_ID,$start_date,$end_date,$metrics,$optParams ); } catch(Exception $e) { var_dump($e); }
我得到了正确的结果.
我想获得实时数据但无法获得它.我试过如下.
$metrics =’rt:medium’;
$optParams = array(‘dimensions’=>’rt:activeUsers’);
try { $results = $service->data_realtime->get( $GA_VIEW_ID,'rt:activeUsers',$optParams); } catch (apiServiceException $e) { // Handle API service exceptions. $error = $e->getMessage(); } // Error : Undefined PRoPErty: Google_AnalyticsService::$data_realtime
以上是脚本宝典为你收集整理的使用php获取谷歌分析实时数据全部内容,希望文章能够帮你解决使用php获取谷歌分析实时数据所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。