OK, I got it. Code is almost correct. Just needed PAUSED and Not PAUSE On Feb 12, 10:51 am, Joe_Rocket <[email protected]> wrote: > I have an update function that updates Keyword Max CPC and Status. > The Max CPC updates fine. But the Keyword Status does not change. > Can you see anything wrong with this code? Thanks in advance. > > /** > * > * @param int $belongsToAdGroupId > * @param int $kwid > * @param int $maxCPC > * @param bool $pause > * @return array > */ > public function updateKeyword($belongsToAdGroupId, $kwid, $maxCPC, > $pause){ > > $result = null; > $adGroupCriteriaService = $this->adWordsUser- > > >GetAdGroupCriterionService('v200909'); > > // Create ad group criterion. > $adGroupCriterion = new BiddableAdGroupCriterion(); > $adGroupCriterion->adGroupId = (float)$belongsToAdGroupId; > $adGroupCriterion->criterion = new Criterion($kwid); > $adGroupCriterion->userStatus = ($pause) ? 'PAUSE' : 'ACTIVE'; > > // Create bids. > $bids = new ManualCPCAdGroupCriterionBids(); > $bids->maxCpc = new Bid(new Money($maxCPC)); > $adGroupCriterion->bids = $bids; > > // Create operations. > $operation = new AdGroupCriterionOperation(); > $operation->operand = $adGroupCriterion; > $operation->operator = 'SET'; > > $operations = array($operation); > > try{ > $keywords = > $adGroupCriteriaService->mutate($operations); > $result = $this->packageResultsAsArray($keywords); > }catch (SoapFault $fault) { > //Extract error and place on fault stack > $this->checkFault($fault); > } > > return $result; > }
-- 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.
