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
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/f11ee251-cf54-40e6-ad78-82467945915e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.