好的,所以我有这个代码设置,我可以得到我的事件类别和动作并过滤一切......但我不能让它显示独特的事件。我在 '$result' 之后添加了 'number_format($result->uniqueEvents())' ,但这并没有返回任何内容。我究竟做错了什么?
谢谢您的帮助
define('ga_email','EMAIL'); // GA Email
define('ga_password','PASSWORD'); // 2-part authorization password
define('profile_id','PROFILE_ID'); // Analytics profile ID
require_once 'gapi/gapi.class.php';
$ga = new gapi(ga_email,ga_password);
$dimensions = array('eventCategory','eventAction');
$metrics = array('totalEvents','uniqueEvents', 'eventsPerVisitWithEvent');
$sort_metric = '-totalEvents';
$ga->requestReportData(profile_id,
$dimensions,
$metrics,
$sort_metric,
$filter='ga:eventAction==company',
$start_date='2013-07-01',
$end_date='2013-07-24',
$start_index=1,
$max_results=50);
$i = 1;
foreach($ga->getResults() as $result):
echo $result . number_format($result->uniqueEvents()) . '<br>' ;
endforeach
?>