Setting CpcBid in a keyword when using the AdGroupCriterionService

190 views
Skip to first unread message

Alan Coleman

unread,
Oct 12, 2015, 12:30:15 PM10/12/15
to AdWords API Forum
Hello everyone,

I'm using the AdGroupCriterionService in an attempt to update the CpcBid in individual keywords.

I've followed the relevant documentation through and am using the following code which is not updating the criterion whilst at the same time not displaying an error of any kind. I know that my $adGroupId and $criterionId are valid because they work elsewhere.

There doesn't seem to be an errors in my SOAP Log.

Here's the documentation I've observed:
Here's my code:


  // Get the service, which loads the required classes.
  $adGroupCriterionService = $user->GetService('AdGroupCriterionService', ADWORDS_VERSION);

  $biddableAdgroupCriterion = new BiddableAdGroupCriterion();
  $biddableAdgroupCriterion->adGroupId = $adGroupId;
  $biddableAdgroupCriterion->criterion = new Criterion($criterionId);
    
  $CPCbid = new CpcBid();
  $CPCbid->bid = new Money(0.035000);
  
  $biddingStrategyConfiguration = new BiddingStrategyConfiguration();
  $biddingStrategyConfiguration->bids = $CPCbid;
  $biddableAdgroupCriterion->biddingStrategyConfiguration = $biddingStrategyConfiguration;

  var_dump($biddableAdgroupCriterion);
  
  // Create operation.
  $operation = new AdGroupCriterionOperation();
  $operation->operand = $biddableAdgroupCriterion;
  $operation->operator = 'SET';

  $operations = array($operation);

  // Make the mutate request.
  $result = $adGroupCriterionService->mutate($operations);


Any help would be appreciated.

Many thanks. 

Anthony Madrigal

unread,
Oct 12, 2015, 3:01:04 PM10/12/15
to AdWords API Forum
Hello Alan,

The only thing in your code that looks like it could give you some issues is where you set the CPC bid to a value of 0.035000. The Money object takes a value of micro-units where 1 million equals to 1 unit (i.e., $1.00). I suggest trying to set the bid to a different amount and see if that helps.

Cheers,
Anthony
AdWords API Team

Alan Coleman

unread,
Oct 13, 2015, 4:18:28 AM10/13/15
to AdWords API Forum
Thank you Anthony,

You are correct, the Money object requires an amount in micros. So setting a bid of £1.23 would look like this:

  $CPCbid->bid = new Money(1230000);

I don't think we've spoken before Anthony, so thanks very much for the help.

Cheers!

Kanan Farzali

unread,
Oct 20, 2015, 7:49:23 AM10/20/15
to AdWords API Forum
Is Criterion ID is a keyword ID here?

Thanks.

Anthony Madrigal

unread,
Oct 20, 2015, 9:42:50 AM10/20/15
to AdWords API Forum
Hi Kanan,

Yes, the Criterion Id in this example is referring to the keyword Id. 

Please let me know if you have any other questions.
Reply all
Reply to author
Forward
0 new messages