简体   繁体   中英

Error using Google Adwords api

I am trying to run a Responsive ad example using adwords api library (php) but it is giving me the following error

Fatal error: Uncaught exception 'Google\AdsApi\AdWords\v201702\cm\ApiException' with message '[OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE @ operations[0].operand.ad; trigger:'SEARCH']' in C:\xampp\htdocs\adfollower\app\Utils\adfollower\src\Google\AdsApi\Common\Util\Reflection.php:39 Stack trace: #0 C:\xampp\htdocs\adfollower\app\Utils\adfollower\src\Google\AdsApi\Common\Util\Reflection.php(39): ReflectionClass->newInstanceArgs(Array) 
    #1 C:\xampp\htdocs\adfollower\app\Utils\adfollower\src\Google\AdsApi\Common\AdsSoapClient.php(162): Google\AdsApi\Common\Util\Reflection->createInstance('Google\\AdsApi\\A...', '[OperationAcces...') 
    #2 C:\xampp\htdocs\adfollower\app\Utils\adfollower\src\Google\AdsApi\Common\AdsSoapClient.php(126): Google\AdsApi\Common\AdsSoapClient->parseApiExceptionFromSoapFault(Object(SoapFault)) 
    #3 C:\xampp\htdocs\adfollower\app\Utils\adfollower\src\Google\AdsApi\AdWords\v201702\cm\AdGroupAdService.php(189): Google\AdsApi\Common\AdsSoapClient->__soapCall('mutate', Array) 
    #4 C:\xampp\ht in C:\xampp\htdocs\adfollower\app\Utils\adfollower\src\Google\AdsApi\Common\Util\Reflection.php on line 39 

The error indicates that you are trying to add a creative to a campaign that is not compatible with its type.

In your specific scenario, you are adding a Responsive Ad to a Search Network Campaign , but this type of creative can only be used in a Display Network Campaign .

The solution is to create a new Display campaign with the proper targetting settings and update the affected campaign ID in your code.

From the error above, it looks like your access details you are providing is incorrect as its giving a permissions error.

You can find an example here: https://github.com/googleads/googleads-php-lib/tree/master/examples/AdWords

Otherwise can you please paste your code (without your access details) so we can see how you are implementing it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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