0
这是一个相当新手的问题,请与我联系...谷歌分析API多个查询 - 第二功能?
我已成功授权我的Google Analytics API帐户并正在进行以下通话,该通话已成功打印跳出率。
我想为网页浏览和会话等内容添加更多查询,我该怎么做?
这是困扰我的功能,我需要为每个查询创建一个新的功能吗?
在此先感谢! 汤姆
function getResults(&$analytics, $profileId) {
// Calls the Core Reporting API and queries for the number of sessions
// for the last seven days.
return $analytics->data_ga->get(
'ga:' . $profileId,
'today',
'today',
'ga:bouncerate');
}
function printResults(&$results) {
// Parses the response from the Core Reporting API and prints
// the profile name and total sessions.
if (count($results->getRows()) > 0) {
// Get the profile name.
$profileName = $results->getProfileInfo()->getProfileName();
// Get the entry for the first entry in the first row.
$rows = $results->getRows();
$sessions = $rows[0][0];
// Print the results.
print "<p>First view (profile) found: $profileName</p>";
print "<p>Total sessions: $sessions</p>";
} else {
print "<p>No results found.</p>";
}