How to get Age Range and Gender of Ad Group via Google Ads API?
I am using Google Ads API SDK for Python. I want to get Age Range and Gender target for each Ad Group. I spent hours on Google Ads API docs but still really cannot understand how to find that. Could you guys please give me a suggestion? A sample GAQL query would be nice ...
EDIT: Apologies, I misunderstood.
You need to use the ad_group_criterion along with the age_range_view to get the metrics associated with each audience you mentioned.
Here's an example:
SELECT ad_group_criterion.gender.type, ad_group_criterion.age_range.type, metrics.clicks, age_range_view.resource_name FROM age_range_viewYou can use either the gender view or the age range view: https://developers.google.com/google-ads/api/fields/v7/gender_view
Sorry, but I still don't get it :( I am new to Python, so I am sorry if this is obvious, but I cannot understand how it works. If you could provide an example code, that will be great.
I misunderstood, apologies. I've updated my answer.
Thanks for the comments! Can I use the 'Ad Group Criterion' table if I only need 4 columns: ad_group_id, campaign_id, gender_type and age_range_type?
In age_range_view, it is not returning any data for ad_group_criterion.gender.type. @ToànĐoàn Did you get both data in single query?