Hello, i would like tho read out the CPC Bid for each keyword. I'm able to get the keywords with the getKewords.php Example. It should be possible to get the CPC Bid with the AdGroupCriterionService? How can i do this?
class GetKeywords { const CAMPAIGN_GROUP_ID = '123742356'; const PAGE_LIMIT = 500; public static function runExample(AdWordsServices $adWordsServices, AdWordsSession $session, $campaignId) { $adGroupCriterionService = $adWordsServices->get($session, AdGroupCriterionService::class); // Create a selector to select all keywords for the specified ad group. $selector = new Selector(); $selector->setFields( ['Id', 'CriteriaType', 'KeywordMatchType', 'KeywordText']); $selector->setOrdering([new OrderBy('KeywordText', SortOrder::ASCENDING )]); $selector->setPredicates([ new Predicate('CampaignId', PredicateOperator::IN, [$campaignId]), new Predicate('CriteriaType', PredicateOperator::IN, [CriterionType::KEYWORD]) ]); $selector->setPaging(new Paging(0, self::PAGE_LIMIT)); $totalNumEntries = 0; do { // Retrieve keywords one page at a time, continuing to request pages // until all keywords have been retrieved. $page = $adGroupCriterionService->get($selector); // Print out some information for each keyword. if ($page->getEntries() !== null) { $totalNumEntries = $page->getTotalNumEntries(); foreach ($page->getEntries() as $adGroupCriterion) { printf($adGroupCriterion->getBiddingStrategyConfiguration()-> getBids()); /*echo $adGroupCriterion->getCriterion()->getText()." - ".$adGroupCriterion->getCriterion()->getMatchType()." - ".$adGroupCriterion->getCriterion()->getType() ." - ".$adGroupCriterion->getCriterion()->getId() ." - ".$adGroupCriterion->getBiddingStrategyConfiguration()->getBids()[0]->getBid() ."<br>";*/ } } $selector->getPaging()->setStartIndex( $selector->getPaging()->getStartIndex() + self::PAGE_LIMIT); } while ($selector->getPaging()->getStartIndex() < $totalNumEntries); printf("Number of results found: %d\n", $totalNumEntries); } public static function main($customer_id) { // Generate a refreshable OAuth2 credential for authentication. $oAuth2Credential = (new OAuth2TokenBuilder()) ->fromFile() ->build(); // Construct an API session configured from a properties file and the OAuth2 // credentials above. $session = (new AdWordsSessionBuilder()) ->fromFile() ->withOAuth2Credential($oAuth2Credential) ->withClientCustomerId($customer_id) ->build(); self::runExample( new AdWordsServices(), $session, intval(self::CAMPAIGN_GROUP_ID)); } } -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com 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 adwords-api+unsubscr...@googlegroups.com. 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/01054ea5-5362-457f-adba-2f6a0a7884c1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.