내 대답은 PHP 개발자를위한 도움이 될 것입니다
내가 v201502 (PHP)를 사용하고 있습니다 , 모든 계정 세부 사항을 ManagedCustomerService
api에서 얻을 수 있습니다.
function DisplayAccountTree($account, $link, $accounts, $links, $depth) {
print str_repeat('-', $depth * 2);
printf("%s, %s\n", $account->customerId, $account->name);
if (array_key_exists($account->customerId, $links)) {
foreach ($links[$account->customerId] as $childLink) {
$childAccount = $accounts[$childLink->clientCustomerId];
DisplayAccountTree($childAccount, $childLink, $accounts, $links,
$depth +1);
}
}
}
function GetAccountHierarchyExample(AdWordsUser $user) {
// Get the service, which loads the required classes.
$user->SetClientCustomerId('xxx-xxx-xxxx');
$managedCustomerService =
$user->GetService('ManagedCustomerService');
// Create selector.
$selector = new Selector();
// Specify the fields to retrieve.
$selector->fields = array('CustomerId', 'Name');
// Make the get request.
$graph = $managedCustomerService->get($selector);
// Display serviced account graph.
if (isset($graph->entries)) {
// Create map from customerId to parent and child links.
$childLinks = array();
$parentLinks = array();
if (isset($graph->links)) {
foreach ($graph->links as $link) {
$childLinks[$link->managerCustomerId][] = $link;
$parentLinks[$link->clientCustomerId][] = $link;
}
}
// Create map from customerID to account, and find root account.
$accounts = array();
$rootAccount = NULL;
foreach ($graph->entries as $account) {
$accounts[$account->customerId] = $account;
if (!array_key_exists($account->customerId, $parentLinks)) {
$rootAccount = $account;
}
}
// The root account may not be returned in the sandbox.
if (!isset($rootAccount)) {
$rootAccount = new Account();
$rootAccount->customerId = 0;
}
// Display account tree.
print "(Customer Id, Account Name)\n";
DisplayAccountTree($rootAccount, NULL, $accounts, $childLinks, 0);
} else {
print "No serviced accounts were found.\n";
}
}
GetAccountHierarchyExample($user);
귀하의 모든 계정의 상위 ID가됩니다을 SetClientCustomerId
다음 URL
https://developers.google.com/adwords/api/docs/reference/v201502/ManagedCustomerService
이 내가 사용하는 샘플 코드를 참조하십시오, 그것은 당신이 구글의 로그인 아웃 버튼 근처에 등장한다 애드워즈 계정
나는이 답변이 도움이 될 것입니다 희망 첨부 된 이미지를 참조하십시오, 아래에 의견 당신이 경우 w 추가하십시오 개미 더 이상 도움이
code.google.com 링크가 더 이상 작동하지 않습니다. @Anash : 업데이트 된 링크를 게시 할 수 있습니까? – Taher