getResults
의 매개 변수를 사용하는 방법은 무엇입니까? 내 웹 사이트 사용자의 URL이 무엇인지보고 싶습니다. 내가 ga:sessions
을 사용할 경우 얼마나 많은 사용자가 있었는지 알 수 있습니다. ga:pageviews
으로 변경하면 (결과 배열의) 번호가 변경됩니다. 그래서 API는 "살아있다"는 뜻입니다.Google 애널리틱스 API에서 매개 변수를 사용하는 방법
사람들이 내 웹 사이트를 시청하기 시작하는 곳에서 "입력 지점"URL을 얻으려면 어떻게해야합니까? 그리고 여기에 매개 변수를 보내는 방법 'ga:sessions');
? 내가 읽던 API 지침은 here입니다. 결과 지금은
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,
'7daysAgo',
'today',
'ga:sessions');
}
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.
echo '<pre>';
print_r($rows);
} else {
print "No results found.\n";
}
}
은 다음과 같습니다
Array
(
[0] => Array
(
[0] => 3585
)
)
감사합니다! 페이지 후 결과 페이지를 표시하는 방법은 무엇입니까? Cuz 기본 최대 결과는 1k입니다. – fonjeekay
죄송합니다. 코드가 없습니다. 하지만 당신이 요청한 결과의 nextpage 토큰을 읽은 다음 치수와 마찬가지로 매개 변수로 새 요청에 전달하면 새 요청을 추가합니다. https://developers.google.com/api-client- 라이브러리/php/guide/pagination 미안 내가 해준 이후로 꽤 오래되었습니다. – DaImTo