gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 16:24:00 25 4
gpt4 key购买 nike

我正在将ZendGData库用于ZF2。

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

$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'];
}
}
}

关于google-analytics - 如何使用ZendGData Analytics获取所有配置文件ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12801328/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com