Querying AdGroupCriterion Service for age range

48 views
Skip to first unread message

C N

unread,
Dec 4, 2017, 4:14:06 AM12/4/17
to AdWords API Forum
I'm trying to get a list of age range criterion that have been selected for an ad group. An age range (e.g. 18-24) was excluded in the UI, and I'm querying the AdGroupCriterion service, expecting that one of the criteria will show that the age range was excluded. However, instead I'm getting a list of all possible age range criteria.

My query is:

query = 'SELECT AgeRangeType,CriteriaType,UserListName,PlacementUrl,GenderType,UserInterestName,Id,CampaignId WHERE CampaignId IN [1003983289]'

which I'm querying using the Python sdk like so:

<AdGroupCriterionService>.query(query)

The results include all possible age ranges, with no indication that any were excluded:

AGE_RANGE_18_24, AGE_RANGE_45_54, AGE_RANGE_25_34, AGE_RANGE_35_44, AGE_RANGE_55_64, AGE_RANGE_UNDETERMINED, AGE_RANGE_65_UP

Is my query incorrect, or my expectations? What query or service should I be using to get the excluded criterion? (I'm having the same issue with gender.)

Bharani Cherukuri (AdWords API Team)

unread,
Dec 4, 2017, 3:17:14 PM12/4/17
to AdWords API Forum
Hello, 

You could use the AdGroupCriterionService.get() or CampaignCriterionService.get() and look for the CriteriaUse as "Negative" to get the excluded criterion at ad group or campaign levels. You could query based on the Criterion object as ageRange to obtain results for the excluded age group. You may refer to our code samples in Java here as a reference. Code samples in other languages can be found here

If you continue to have an issue with this, please provide us the complete SOAP request and response logs along with the clientCustomerId so I can take a look and assist you further. Please use Reply privately to author option to provide the logs.

Regards,
Bharani, AdWords API Team
Reply all
Reply to author
Forward
0 new messages