繁体   English   中英

使用API​​创建AdWords Campign时出错

[英]Error when creating adwords campign using api

我正在使用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”)不是此服务的有效方法

如果您想使用php sdk更改/设置clientCustomerId ,则必须在创建Adwords会话时执行以下操作:

$session = (new AdWordsSessionBuilder())
    ->fromFile()
    ->withOAuth2Credential($oAuth2Credential)
    ->withClientCustomerId(clientCustomerId)
    ->build();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM