Google Ads Get Campaign ads spends based on date and all states of USA

35 views
Skip to first unread message

Darren D'Mello

unread,
Jun 8, 2022, 6:16:12 AM6/8/22
to Google Ads API and AdWords API Forum

I am using ads API for getting the spends based on state names of USA.

The below query gives segments.geo_target_state will be returned as an ID instead of name How can I combine this query with SELECT geo_target_constant.name, geo_target_constant.canonical_name FROM geo_target_constant WHERE geo_target_constant.id = <<OBTAINED ID FROM THE BELOW QUERY>>

curl "https://googleads.googleapis.com/v10/customers/${CUSTOMER_ID}/googleAds:searchStream" \ --header "Content-Type: application/json" \ --header "developer-token: ${DEVELOPER_TOKEN}" \ --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \ --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \ --data '{ "query": " SELECT campaign.name, segments.geo_target_state, metrics.cost_micros FROM geographic_view WHERE geographic_view.location_type = LOCATION_OF_PRESENCE AND segments.date BETWEEN 20220101 AND 20220430 " }'

Google Ads API Forum Advisor

unread,
Jun 8, 2022, 9:31:51 AM6/8/22
to miscellan...@gmail.com, adwor...@googlegroups.com

Hi Darren,

Thanks for reaching out to the Google Ads API Forum.

You may need to perform a separate request for the geo_target_constant report after pulling segments.geo_target_state  from geographic_view report in order to get the name of those states. There is no way to combine two GAQL together in Google Ads API.

Regards,

Google Logo
Yasar
Google Ads API Team
 


ref:_00D1U1174p._5004Q2bdUzg:ref

Darren D'Mello

unread,
Jun 8, 2022, 10:18:03 AM6/8/22
to ads...@forumsupport.google, adwor...@googlegroups.com
Could you please help me get that via a Select statement?

I am looking for summary output as shown here, am I doing something wrong?


Do I need to get location based report? I am unsure how to get that via API.
Reply all
Reply to author
Forward
0 new messages