$adGroupCriterionService = $adWordsServices->get($session, AdGroupCriterionService::class);
$operations = [];
$keyword = new Keyword();
$keyword->setId($criterionId);
$keyword->setText('best science magazines');
$keyword->setMatchType(KeywordMatchType::BROAD);
$adGroupCriterion = new BiddableAdGroupCriterion();
$adGroupCriterion->setAdGroupId($adGroupId);
$adGroupCriterion->setCriterion($keyword);
$adGroupCriterion->setBidModifier(1.5);
// Create ad group criterion operation and add it to the list.
$operation = new AdGroupCriterionOperation();
$operation->setOperand($adGroupCriterion);
$operation->setOperator(Operator::ADD);
$operations[] = $operation;
// Create the ad group criteria on the server and print out some information
// for each created ad group criterion.
// try {
$result = $adGroupCriterionService->mutate($operations);
// } catch (\Exception $e) {
// return array(
// "status" => "fail",
// "message" => 'Caught exception: '. $e->getMessage()
// );
// }
$adGroupCriterion = $result->getValue()[0];
$data = array(
"message" => "Keyword with ID %d has updated final URL ",
"id" => $adGroupCriterion->getCriterion()->getId()
);
array_push(self::$keywords, $data);
<br />
<b>Fatal error</b>: Uncaught Google\AdsApi\AdWords\v201806\cm\ApiException: [CriterionError.CANNOT_BID_MODIFY_CRITERION_TYPE @ operations[0].operand.bidModifier] in /Applications/MAMP/htdocs/native_adwords/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/Util/Reflection.php:43
Stack trace:
#0 /Applications/MAMP/htdocs/native_adwords/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/Util/Reflection.php(43): ReflectionClass->newInstanceArgs(Array)
#1 /Applications/MAMP/htdocs/native_adwords/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php(202): Google\AdsApi\Common\Util\Reflection->createInstance('Google\\AdsApi\\A...', Array)
#2 /Applications/MAMP/htdocs/native_adwords/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/AdsSoapClient.php(164): Google\AdsApi\Common\AdsSoapClient->parseApiExceptionFromSoapFault(Object(SoapFault))
#3 /Applications/MAMP/htdocs/native_adwords/vendor/googleads/googleads-php-lib/src/Google/AdsApi/AdWords/v201806/cm/AdGroupCriterionService.php(198 in
<b>/Applications/MAMP/htdocs/native_adwords/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Common/Util/Reflection.php</b> on line
<b>43</b>
<br />