I am using ZendGData library for ZF2.
I tried to get account`s data, but there is no data about profiles.
$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());
How can I get list of profiles (or profile ids) for my account?
I have found solution:
$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'];
}
}
}