0
gapi를 사용하여 Google에서 내 일정 데이터를 가져 오는 방법은 무엇입니까?GAPI Google Analytics
"소스"및 "방문"을 검색하는 샘플 코드가 있습니다. 'Play'라는 액션으로 '동영상'카테고리에서 내 이벤트를 원합니다. 각 이벤트의 이름은 파일 이름입니다.
여기에 일반 방문을 내 현재 작업 코드입니다 : 내가 함수 이름이 어떻게 될지 추측 할 수 있었다
<?php
require 'gapi-1.3/gapi.class.php';
/* Set your Google Analytics credentials */
define('ga_account' ,'dadadadad');
define('ga_password' ,'adadadad');
define('ga_profile_id' ,'dadadadad');
$ga = new gapi(ga_account,ga_password);
/* We are using the 'source' dimension and the 'visits' metrics */
$dimensions = array('source');
$metrics = array('visits');
/* We will sort the result be desending order of visits,
and hence the '-' sign before the 'visits' string */
$ga->requestReportData(ga_profile_id, $dimensions, $metrics,'-visits');
$gaResults = $ga->getResults();
$i=1;
foreach($gaResults as $result)
{
printf("%-4d %-40s %5d\n",
$i++,
$result->getSource(),
$result->getVisits());
echo '<br/>';
}
echo "\n-----------------------------------------\n";
echo "Total Results : {$ga->getTotalResults()}";
?>