我尝试从Google Ads API PHP Lib获取客户经理链接。但是它们除外Resource_name。那是什么?
$client->getCustomerManagerLinkServiceClient()->getCustomerManagerLink(resourceName)->getManagerLinkId();
对于此新服务,他们没有PHP文档。他们有一些例子,但我需要的例子还不存在。
我尝试将现有的广告/ AdWords客户合并到我的Google Ads Manager(MCC)中。但是我不知道该怎么办。
感谢帮助。
干杯。
答案 0 :(得分:0)
有人可以帮助我吗?
这是我的代码,如果您想了解更多。 面临的挑战是仅使用此Github中的Google Ads Api库:https://github.com/googleads/google-ads-php
我不想使用Google Adwords API,只是Google Ads API。
$oAuth2Credential = (new OAuth2TokenBuilder())
->fromFile('google_ads_php.ini')
->withRefreshToken(self::getRefreshToken())
->build();
$googleAds = (new GoogleAdsClientBuilder())
->fromFile('google_ads_php.ini')
->withOAuth2Credential($oAuth2Credential)
->build();
$resourceName = Customer ID;
$customerManagerLinkOperation = new \Google\Ads\GoogleAds\V0\Services\CustomerManagerLinkOperation([
'manager_customer' => new StringValue(['value' => $googleAds->getLoginCustomerId()])
]);
$googleAds->getCustomerManagerLinkServiceClient()->mutateCustomerManagerLink($resourceName,$customerManagerLinkOperation);
答案 1 :(得分:0)
我对php库并不熟悉,但是对于python库,您可以将GoogleAdsService与google ads查询一起使用来检索数据。
示例:
cutomer_id = '11111111111'
q = ('SELECT customer_manager_link.manager_customer, '
'customer_manager_link.status '
'FROM customer_manager_link'
result = ga_service.search(customer_id, q)
我认为在php中也应该如此。像这样:
$googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient();
$customerId = 11111111111
$query = 'SELECT customer_manager_link.manager_customer, '
.'customer_manager_link.status '
.'FROM customer_manager_link'
$response = $googleAdsServiceClient->search($customerId, $query);