Hello Team,
Goal: Change bid of keyword with broad match type.
I have a keyword with broad match type i.e. '+ultrafiltration +filtration'. We want to modify the bid of this keyword but we are getting this error message 'Invalid id'.
My code is as follows for keyword bid modifier. please have a look and suggest me how to make it success for this keyword.
$user = new AdwordsUser();
$user->SetClientCustomerId($clientId); // ClientId
$adGroupCriterionService = $user->GetService('AdGroupCriterionService', ADWORDS_VERSION);
//echo '<pre>';print_r($data1);
$operations = array();
foreach($data1 as $k=>$v) {
$data = explode('=',$v);
//$data = explode('=',$data);
//$data[0]; // campaignId
//$data[1]; // keywordId
//data[2]; // adgroupId
//data[3]; //bid to set
//data[4]; //keywordName
$criterion = new Criterion();
$criterion->id = $data[1]; // KeywordId
// Create biddable ad group criterion.
$adGroupCriterion = new BiddableAdGroupCriterion();
$adGroupCriterion->adGroupId = $data[2]; // adgroupId
$adGroupCriterion->criterion = new Criterion($data[1]);
$bid = new CpcBid();
//$bid->bid = new Money($bidNonMicro * AdWordsConstants::MICROS_PER_DOLLAR);
$bid->bid = new Money((float) $data[3]*1000000);
$biddingStrategyConfiguration = new BiddingStrategyConfiguration();
$biddingStrategyConfiguration->bids[] = $bid;
//echo "<pre>";
//print_r($biddingStrategyConfiguration);
//die();
$adGroupCriterion->biddingStrategyConfiguration = $biddingStrategyConfiguration;
$operation = new AdGroupCriterionOperation();
$operation->operand = $adGroupCriterion;
$operation->operator = 'SET';
$operations[] = $operation;
}
//return $operation;
//$operations = array($operation);
//echo '<pre>';
//print_r($operations);
//die();
try{
$results = $adGroupCriterionService->mutate($operations);
/* echo '<pre>';
print_r($results);
die(); */
if (count($results->value)) {
return 1;
}else{
return 0;
}
}catch(Exception $e){
// Error
return array('Exception Error');
}
Thank You.
Regards
Sachin Kumar