how to get household income data

98 views
Skip to first unread message

Harisankar Mohanty

unread,
Dec 8, 2018, 4:07:12 PM12/8/18
to AdWords API and Google Ads API Forum
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;

        
    }
GetCampaignTargetingCriteria.php

Dannison Yao (AdWords API Team)

unread,
Dec 9, 2018, 10:13:41 PM12/9/18
to AdWords API and Google Ads API Forum
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 on how to do so.

Regards,
Dannison
AdWords API Team

Anash P. Oommen (AdWords API Team)

unread,
Dec 12, 2018, 6:27:29 PM12/12/18
to AdWords API and Google Ads API Forum
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.

Harisankar Mohanty

unread,
Dec 13, 2018, 12:33:55 AM12/13/18
to adwordsapia...@google.com, AdWords API and Google Ads API Forum
Hello Sir,

But in our cases criteria are set for age range , income range etc .. still then we are not getting info using criteraType as 'AGE_RANGE', 'INCOME_RANGE' in campaigncriterionservice ..

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api...@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 a topic in the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-api/0Owk0Zp02Ps/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-api...@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.

Anash P. Oommen (AdWords API Team)

unread,
Dec 13, 2018, 10:08:11 AM12/13/18
to AdWords API and Google Ads API Forum
HI Hari,

Could you kindly respond to this thread privately and share with me one or more campaign IDs so I can take a look?

Cheers
Anash P. Oommen,
AdWords API Advisor.


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 a topic in the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-api/0Owk0Zp02Ps/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-api+unsubscribe@googlegroups.com.

Harisankar Mohanty

unread,
Dec 18, 2018, 12:54:53 PM12/18/18
to Anash Oommen, AdWords API and Google Ads API Forum
Hello Anash,

I have already sent the required details privately to you in the thread. Please look at it and let me know.


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 a topic in the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-api/0Owk0Zp02Ps/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-api...@googlegroups.com.

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to

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 a topic in the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-api/0Owk0Zp02Ps/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-api...@googlegroups.com.

Harisankar Mohanty

unread,
Dec 21, 2018, 8:41:01 AM12/21/18
to Anash Oommen, AdWords API and Google Ads API Forum, Chris Bergstrom
Hello Anash,

I have replied to your private mail in the thread asking about the service and criteria Type that we need to use to retrieve data related to Income Tiers. Can you please look at this ?

Reply all
Reply to author
Forward
0 new messages