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>";
}