Google analytics 如何使用ZendGData Analytics获取所有配置文件ID?

Google analytics 如何使用ZendGData Analytics获取所有配置文件ID?,google-analytics,zend-framework2,zend-gdata,Google Analytics,Zend Framework2,Zend Gdata,我正在使用ZF2的ZendGData库 我试图获取帐户的数据,但没有关于个人资料的数据 $email = $this->config['email']; $password = $this->config['password']; $service = \ZendGData\Analytics::AUTH_SERVICE_NAME; $client = \ZendGData\ClientLogin::getHttpClient($email, $password, $service

我正在使用ZF2的ZendGData库

我试图获取帐户的数据,但没有关于个人资料的数据

$email = $this->config['email'];
$password = $this->config['password'];

$service = \ZendGData\Analytics::AUTH_SERVICE_NAME;
$client = \ZendGData\ClientLogin::getHttpClient($email, $password, $service);
$analytics = new \ZendGData\Analytics($client);

print_r($analytics->getAccountFeed());
如何获取我的帐户的配置文件(或配置文件ID)列表?

我找到了解决方案:

$email = $this->config['email'];
$password = $this->config['password'];

$service = \ZendGData\Analytics::AUTH_SERVICE_NAME;
$client = \ZendGData\ClientLogin::getHttpClient($email, $password, $service);
$analytics = new \ZendGData\Analytics($client);

$profileResult = $analytics->getDataFeed($analytics->newAccountQuery()->profiles());

$profileIds = array();
/**
 * @var \ZendGData\Analytics\DataEntry $dataBit
 */
 foreach ($profileResult as $dataBit) {
     /**
       * @var \ZendGData\App\Extension\Element $element
       */
     foreach ($dataBit->getExtensionElements() as $element) {
         $attributes = $element->getExtensionAttributes();
         if ($attributes['name']['value']=='ga:profileId') {
             $profileIds[] = $attributes['value']['value'];
         }
    }
}
我找到了解决办法:

$email = $this->config['email'];
$password = $this->config['password'];

$service = \ZendGData\Analytics::AUTH_SERVICE_NAME;
$client = \ZendGData\ClientLogin::getHttpClient($email, $password, $service);
$analytics = new \ZendGData\Analytics($client);

$profileResult = $analytics->getDataFeed($analytics->newAccountQuery()->profiles());

$profileIds = array();
/**
 * @var \ZendGData\Analytics\DataEntry $dataBit
 */
 foreach ($profileResult as $dataBit) {
     /**
       * @var \ZendGData\App\Extension\Element $element
       */
     foreach ($dataBit->getExtensionElements() as $element) {
         $attributes = $element->getExtensionAttributes();
         if ($attributes['name']['value']=='ga:profileId') {
             $profileIds[] = $attributes['value']['value'];
         }
    }
}