如何在 php 的谷歌分析中显示搜索概述?
显示谷歌分析页面
访问 76
我正在使用这个功能ga:organicSearches链接在这里developers.google.com/analytics/devguides/reporting/core
我想在我的新分析网站中显示此数据,但此功能显示74 次访问
我可以知道我错在哪里。
到目前为止,这是我的代码:-
$ga1 = new gapi($ga_email,$ga_password);
/* We are using the 'source' dimension and the 'visits' metrics */
$dimensions = array('source');
$metrics = array('visits','organicSearches');
/* We will sort the result be desending order of visits,
and hence the '-' sign before the 'visits' string */
$ga1->requestReportData($ga_profile_id,
$dimensions,
$metrics,
'-visits', // Sort by 'visits' in descending order
$filter, // Filter the data
'2012-10-05', // Start Date
'2012-11-04', // End Date
1, // Start Index
500 // Max results
);
$gaResults = $ga1->getResults();
$i=1;
foreach($gaResults as $result)
{
printf("%-4d %-40s %5d\n",
$i++,
$result->getSource(),
$result->getVisits());
}
echo "\n-----------------------------------------\n";
echo "Total Results : {$ga1->getTotalResults()}";
echo "getOrganicSearches:".$ga1->getOrganicSearches().'<br />';
有没有其他功能可以显示这些数据???
谢谢