簡體   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