Change bid Modifier of keyword with broad match type

26 views
Skip to first unread message

Sachin Kumar

unread,
Aug 8, 2016, 2:42:00 PM8/8/16
to AdWords API Forum
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




Anthony Madrigal

unread,
Aug 8, 2016, 3:00:00 PM8/8/16
to AdWords API Forum
Hi Sachin,

Updating a keyword's bid should work regardless of its match type. The likely reason you are seeing this error is that the keyword Id is incorrect or has the wrong ad group Id.  Could you please reply privately to author your SOAP request and response where you are seeing this error?

Thanks,
Anthony
AdWords API Team
Reply all
Reply to author
Forward
0 new messages