我正在使用Google AdWords API通过添加广告系列名称,关键字,预算等直接从wordpress帖子或页面创建广告系列。
$campaignService = $adWordsServices->get($session, CampaignService::class);
$campaignService->SetClientId( 'xxxxxxxxxx' );
$operations = [];
// Create a campaign with required and optional settings.
$campaign = new Campaign();
$campaign->setName('Interplanetary Cruise #' . uniqid());
$campaign->setAdvertisingChannelType(AdvertisingChannelType::SEARCH);
但是我遇到下一个错误:
[OperationAccessDenied.ADD_OPERATION_NOT_PERMITTED @操作[0],OperationAccessDenied.ADD_OPERATION_NOT_PERMITTED @操作[1]
似乎我们需要为此设置客户ID,因此我们使用的是SetClientId()
,但这又给了另一个错误
函数(“ SetClientId”)不适用于该服务
答案 0 :(得分:2)
如果要使用php sdk更改/设置clientCustomerId
,则在创建Adwords会话时必须这样做:
$session = (new AdWordsSessionBuilder())
->fromFile()
->withOAuth2Credential($oAuth2Credential)
->withClientCustomerId(clientCustomerId)
->build();