Hi Harisankar, Demographic criteria like INCOME_RANGE, AGE_RANGE, GENDER are criteria that are enabled by default for all audience, so we don't explicitly add these criteria in a campaign. These criteria appear in a campaign only when you explicitly do something with those critieria (e.g. add a negative age range criteria, or apply a bid adjustment to a specific gender).
E.g. if you can't retrieve Gender criteria for a campaign, you should interpret it as "there's no special gender criteria for this campaign, so it is serving to GENDER_MALE, GENDER_FEMALE and GENDER_UNDETERMINED). Hope this helps? Let me know if you have more questions. Cheers Anash P. Oommen, AdWords API Advisor. On Saturday, December 8, 2018 at 4:07:12 PM UTC-5, 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 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 and Google Ads 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/0ae9894b-fc57-4df3-a6ca-888a289ac01d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.