[英]Google Analytics API PHP -Get Top 5 Pages
I'm trying to work out how to get the top 5 pages from my Google Analytics Project API in PHP. 我正在尝试研究如何从PHP中获取Google Analytics Project API的前5页。 So far I've made the following code, but it doesn't appear to work - any ideas?
到目前为止,我已经制作了以下代码,但它似乎没有用 - 任何想法?
private function getTopPages($profileId) {
$optParams = array(
'sort' => 'ga:pageviews',
'max-results' => '5');
return $this->analytics->data_ga->get(
'ga:' . $profileId,
'2012-09-01',
'2012-09-30',
'ga:pagePath',
$optParams);
}
private function getTopPages($profileId) {
$optParams = array(
'max-results' => 5,
'dimensions' => 'ga:pageTitle,ga:pagePath',
'sort' => '-ga:pageviews',
);
return $this->analytics->data_ga->get(
'ga:' . $profileId,
'2012-09-01',
'2012-09-30',
'ga:pageviews',
$optParams);
}
inspired by: http://axiacore.com/blog/how-get-list-most-popular-pages-google-analytics-python/ 灵感来自: http : //axiacore.com/blog/how-get-list-most-popular-pages-google-analytics-python/
I don't know the specifics of the php calls, but I see the following potential problems with your call: 我不知道php调用的具体细节,但我看到你的调用存在以下潜在问题:
I have found GA Explorer Tool to be of help. 我发现GA Explorer工具有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.