我在Google Analytics中有一个非常简单的自定义报告,列出了某个月的日期,访问次数,唯一身份访问者和浏览量。如何使用GAPI和Google Analytics每天获得唯一的访问者?
我想使用GAPI复制这个非常简单的报告,但我找不到一个简单的方法将唯一访客添加到我的表。
看到我的代码如下。如何修改此代码以显示唯一身份访问者?
$profile_id = "xxxxxxxx";
$report_id = "xxxxxxxx";
$dimensions = array('date');
$metrics = array('pageviews','visits');
$sort_metric = array('date');
$filter = null;
$start_date = '2013-02-01';
$end_date = '2013-02-28';
$start_index = 1;
$max_results = 10000;
echo '<table>';
echo '<tr>';
echo '<th>Date</th>';
echo '<th>Visits</th>';
echo '<th>Unique Visitors</th>';
echo '<th>Page Views</th>';
echo '</tr>';
$ga = new gapi('[email protected]','xxxxxxxx');
$ga->requestReportData($profile_id, $dimensions, $metrics, $sort_metric, $filter, $start_date, $end_date, $start_index, $max_results);
foreach($ga->getResults() as $result)
{
echo '<td>' . $result->getDate() . '</td>';
echo '<td>' . $result->getVisits() . '</td>';
echo '<td>' . '?' . '</td>';
echo '<td>' . $result->getPageviews() . '</td>';
echo '</tr>';
}
echo "</table>";
欢迎堆栈溢出。虽然这可能会回答这个问题,但提供更多关于如何回答问题的信息会使这个问题更好。 – 2016-04-06 12:29:50