How to get targeted age and gender from ad_group_criterion

146 views
Skip to first unread message

Luke Barr

unread,
Feb 16, 2022, 8:55:25 AM2/16/22
to Google Ads API and AdWords API Forum
Currently we have targeted our campaign to a specific age/gender through the web interface:
target.png

I am now trying to retrieve this targeted demographic gender and age (Male, 18 - 24) via the API, however my query below returns all possible enum values as opposed to what is actually targeted?:

Query: 

SELECT
            ad_group_criterion.age_range.type,
            ad_group_criterion.gender.type
        FROM ad_group_criterion
        WHERE ad_group.id = {ad_group_id}

Outputs:

resource_name: "customers..."
gender {
  type_: MALE
}
resource_name: "customers..."
gender {
  type_: FEMALE
}
resource_name: "customers..."
gender {
  type_: UNDETERMINED
}
resource_name: "customers..."
age_range {
  type_: AGE_RANGE_18_24
}
resource_name: "customers..."
age_range {
   type_: AGE_RANGE_25_34
}
resource_name: "customers..."
age_range {
  type_: AGE_RANGE_35_44
}
etc..


Is there a way to retrieve only the targeted demographics given the ad_group_id so the output just looks like:

gender {
  type_: MALE
}
age_range {
  type_: AGE_RANGE_18_24
}
As shown in the targeted screenshot above.

Thanks!

Google Ads API Forum Advisor

unread,
Feb 17, 2022, 12:27:53 AM2/17/22
to lu...@glimpse.ie, adwor...@googlegroups.com
Hi Luke,

Thank you for posting your concern.

I would suggest to include the filters below so that you can only retrieve specific age range and gender in the report:
WHERE ad_group_criterion.age_range.type = 'AGE_RANGE_18_24' AND ad_group_criterion.gender.type = 'MALE'

If you want to add more filters and fields, then I would suggest using the ad_group_criterion query builder.

Let me know if you have further questions.

Regards,
Google Logo
Ernie John
Google Ads API Team
 


ref:_00D1U1174p._5004Q2WwFNZ:ref
Reply all
Reply to author
Forward
0 new messages