0

我正在尝试使用 GAPI 显示前 5 个非移动浏览器。我似乎找不到这样做的方法,这甚至可能吗?
这就是我获得移动访问百分比的方式:

$ga->requestReportData(GA_PROFILE_ID, array("isMobile"), array("visits"), '-visits', null, $startdate, $enddate);
foreach ($ga->getResults() AS $result) {

    if ((string)$result == "Yes") $mobile["yes"] = $result->getVisits();
    else $mobile["no"] = $result->getVisits();

}
4

1 回答 1

1

这就是我最终这样做的方式:

public function getDevices($max = 5) {
    $this->ga->requestReportData($this->profileid, array('mobileDeviceInfo'), array('visits'), '-visits', 'mobileDeviceInfo != (not set) && mobileDeviceInfo != (not provided)', $this->startdate, $this->enddate, 1, $max);
    foreach ($this->ga->getResults() as $result) {
        $device[] = (string)$result;
        $visits[] = $result->getVisits();
    }
    if (!isset($device) OR !isset($visits)) {
        $device[] = "Niet genoeg data beschikbaar";
        $visits[] = "0";
    }
    $return = array("device" => $device, "visits" => $visits);
    return $return;
}
于 2013-04-11T09:39:26.513 回答