Hi, To further investigate, could you provide the complete SOAP request and response logs that were generated when you were trying to retrieve the INCOME_RANGE? You may provide them using the *reply privately to author* option.
If you have not enabled logging yet, you may refer to this guide <https://github.com/googleads/googleads-php-lib/blob/master/README.md#logging> on how to do so. Regards, Dannison AdWords API Team On Sunday, December 9, 2018 at 5:07:12 AM UTC+8, Harisankar Mohanty wrote: > > Hello API Team, > > I am using Google Adwords API version : v201806 (PHP) to develop a web app. > > I am struck somewhere to retrieve Household Income Tier for a particular > Campaign. Though I am getting info for criteria type 'LOCATION' but other > criteria type does not work for me like 'INCOME_RANGE' or 'AGE_RANGE' etc. > I have posted my code below. Can you please check and let me know why I am > not getting data for Household Income Tier when I use criteria type > 'INCOME_RANGE' ? > > public static function runExample ( > AdWordsServices $adWordsServices, > //AdWordsSession $session > AdWordsSessionBuilder $sessionBuilder, > $customerId, $campaignId = null, $locationIds = null, > $criteriaType = null > ) { > > $session = > $sessionBuilder->withClientCustomerId($customerId)->build(); > $campaignCriterionService = $adWordsServices->get($session, > CampaignCriterionService::class); > > $selector = new Selector(); > > $selector->setFields(array('Id','CampaignId','MatchingFunction','LocationName','Address')); > $predicates[] = new Predicate('CampaignId', PredicateOperator::IN, > array($campaignId)); > //$predicates[] = new Predicate('CriteriaType', > PredicateOperator::IN, array('AD_GROUPS')); > $predicates[] = new Predicate('CriteriaType', PredicateOperator::IN, > array($criteriaType)); > > $selector->setPredicates($predicates); > > $startIndex = 0; > > $selector->setPaging(new Paging($startIndex, 10)); > echo "<pre>"; > print_r($selector); > > do { > // Make the get request. > $page = $campaignCriterionService->get($selector); > > echo "<pre>"; > print_r($page); > die(); > > // Display results. > if (!empty($page->getEntries())) { > //return $page->entries; > $return['data'] = $page->getEntries(); > > > > foreach ($page->getEntries() as $campaignCriterion) { > > > if(in_array($campaignCriterion->getCriterion()->matchingFunction->rhsOperand[0]->locations[0], > > $locationIds)) { > > $locations[$campaignCriterion->criterion->id]['location'] = > $campaignCriterion->criterion->matchingFunction->rhsOperand[0]->locations[0]; > > $locations[$campaignCriterion->criterion->id]['tier'] = > $campaignCriterion->criterion->matchingFunction->lhsOperand[0]->tier; > } > } > > } else { > //print "No campaign targeting criteria were found.\n"; > $locations = false; > } > //$return['locations'] = array_unique($locations); > //return $locations; > > // Advance the paging index. > $startIndex += 10; > $selector->getPaging()->setStartIndex($startIndex); > } while ($page->totalNumEntries > $selector->getPaging()->getStartIndex()); > > return $locations; > > > } > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog: https://googleadsdeveloper.blogspot.com/ =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads 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 --- You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. 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/87eebeb3-8be4-4f81-9fda-c13bf6126f3e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
