How do I get the current CPC bid for a keyword in Google AdWords API?

3.1k views Asked by At

How do I get the current bid for a keyword in my account? I tried

$adGroupCriterion->biddingStrategyConfiguration->bids[0]->bid->value * AdWordsConstants::MICROS_PER_DOLLAR;

But it gave me an error 'Trying to get property of non-object'. When I add the keyword, I'm able to get the bid in the return value OK.

The bid doesn't appear to be selectable in a GET operation. I've searched all over the documentation for it.

https://developers.google.com/adwords/api/docs/reference/v201502/AdGroupCriterionService.BiddableAdGroupCriterion#biddingStrategyConfiguration

https://developers.google.com/adwords/api/docs/reference/v201502/AdGroupCriterionService.Bids

Although this field is returned in the response, it is ignored on input and cannot be selected.

I'm using this example to fetch the keywords:

https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/v201502/BasicOperations/GetKeywords.php#L43

1

There are 1 answers

0
Chloe On BEST ANSWER

I found it.

https://developers.google.com/adwords/api/docs/reference/v201502/AdGroupCriterionService.CpcBid#bid

$selector->fields = array('Id', 'KeywordText', 'KeywordMatchType', 'AdGroupId', 'Status', 'CpcBid');

And I had the property and operator wrong:

$adGroupCriterion->biddingStrategyConfiguration->bids[0]->bid->microAmount / AdWordsConstants::MICROS_PER_DOLLAR;

Sorry to bother you.