Segments ad_group and location

70 views
Skip to first unread message

support opl

unread,
Sep 15, 2025, 3:12:55 AM (11 days ago) Sep 15
to Google Ads API and AdWords API Forum
May I ask how to get  metrics from “resources with metrics”  simultaneously including  segments   ad_group and  location?
We have already tried  “location_view”、 “user_location_view”、“ad_group_audience_view” and did not achieve the desired results

Google Ads API Forum Advisor

unread,
Sep 15, 2025, 5:58:23 AM (11 days ago) Sep 15
to opl....@gmail.com, adwor...@googlegroups.com

Hi,

Thank you for reaching out to the Google Ads API support team.

Based on the provided information, I understand that you want to retrieve the metrics including ad group and location through the Google Ads API.  I would recommend you to use the  geographic_view report to retrieve the matched locations data of the ad group through the Google Ads API. Please be informed that the geographic_view report is used to retrieve the data displayed for an ad group under the ‘Insights and Reports’ -> ’When and where ads showed’ -> ’Matched locations’ tab in the UI. Kindly use the below sample GAQL query by giving the ag group ID, this query retrieves only the IDs of the state and city.

SELECT segments.geo_target_state, segments.geo_target_city, campaign.name, ad_group.name, ad_group.id, segments.geo_target_region, segments.geo_target_county, geographic_view.resource_name, geographic_view.location_type, geographic_view.country_criterion_id FROM geographic_view WHERE ad_group.id = XXXXXX

After retrieving the IDs as "geoTargetCity": "geoTargetConstants/******", "geoTargetState": "geoTargetConstants/*****", you can use the following query to retrieve the corresponding state and city names using geo_target_constant report.

SELECT geo_target_constant.canonical_name, geo_target_constant.country_code, geo_target_constant.resource_name, geo_target_constant.name, geo_target_constant.id  FROM geo_target_constant WHERE geo_target_constant.id = *****

You can use the search or searchStream methods in making the API calls while retrieving the data. Additionally, you can utilize the Google Ads Query Builder and Query Validator to build and validate the queries for retrieving the data from the Google Ads API. Additionally, please specify the geoTargetState and geoTargetCity IDs individually in the geo_target_constant.id field to retrieve the corresponding state and city names.

If this is not what you are looking for, kindly provide the uncropped UI screenshot of the data that you are trying to retrieve along with the Google Ads customer ID so that we can investigate your issue further.

You can send the details via Reply privately to the author option, or direct private reply to this email.

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-09-15 09:57:28Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u6bxh:ref" (ADR-00332746)



support opl

unread,
Sep 17, 2025, 5:04:59 AM (9 days ago) Sep 17
to Google Ads API and AdWords API Forum
Thanks !we have successfully get the data
but we found that some country_criterion_id cannot  return data from the geo_target_constant
for example 2192 and 2364  

we also search from the CSV of geo targets  it's  not a Criteria ID or Parent ID

  geographic_view {
    resource_name: "customers/***********/geographicViews/2192~LOCATION_OF_PRESENCE"
    country_criterion_id: 2192
  }

shell we ask the reason?And how to locate this  country_criterion_id   ?

Google Ads API Forum Advisor

unread,
Sep 17, 2025, 9:41:33 AM (9 days ago) Sep 17
to opl....@gmail.com, adwor...@googlegroups.com
Hi,

In order to assist you further, could you please share the uncropped UI screenshot by highlighting the data that you are trying to retrieve via the Google Ads API along with the complete API logs (request and response with request-id and request header) generated at your end while uploading the conversions via the API?

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java.NetPHPPythonRuby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.


Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-09-17 13:40:44Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u6bxh:ref" (ADR-00332746)



support opl

unread,
Sep 17, 2025, 10:37:22 PM (9 days ago) Sep 17
to Google Ads API and AdWords API Forum
Hello 

 this is our request:
'SELECT campaign.name,campaign.id, ad_group.name, ad_group.id, geographic_view.country_criterion_id,' 'metrics.all_conversions_value,metrics.clicks,metrics.all_conversions,metrics.conversions_value,metrics.cost_micros,metrics.impressions,metrics.ctr ' 'FROM geographic_view where ' 'segments.date="{}"'

request_id: "zldsJ3O5iqjMs5MfJG6vwA"
query_resource_consumption: 10498

this is our response:(Please check the email attachment for all the  response  

5ebff4c5-df33-4542-8816-1f8a470dba4f.png
response.txt

Google Ads API Forum Advisor

unread,
Sep 18, 2025, 4:00:47 AM (8 days ago) Sep 18
to opl....@gmail.com, adwor...@googlegroups.com
Hi,

According to the Non targetable locations, some countries or territories are not targetable in Google Ads but might appear in reports based on the user's location of interest or physical location.

Unfortunately the countries Cuba (2192) and Iran (2364) aren't retrievable from the geo_target_constant and don't appear in .csv of geo targets file even though you can get in the geographic_view. To know about the reason and other restricted countries refer to the Check the list of restricted countries.
 

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-09-18 08:00:05Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u6bxh:ref" (ADR-00332746)



support opl

unread,
Sep 18, 2025, 4:48:24 AM (8 days ago) Sep 18
to Google Ads API and AdWords API Forum
Thanks we find  Cuba (2192) and Iran (2364)
But some country also cannot find  , like 2760
where we can check these?

Google Ads API Forum Advisor

unread,
Sep 18, 2025, 7:59:19 AM (8 days ago) Sep 18
to opl....@gmail.com, adwor...@googlegroups.com

Hi,

Please note that the countries (Crimea - 21120, Cuba - 2192, So-called Donetsk People's Republic (DNR) - 21113, Iran - 2364, So-called Luhansk People's Republic (LNR) - 21111, North Korea - 2408, Syria - 2760) are subject to OFAC sanctions. As per this documentation, google must comply with sanctions imposed by the United States Office of Foreign Assets Control (OFAC). As a result, Google Ads isn't available to advertisers in these countries or territories.

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-09-18 11:58:38Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01u6bxh:ref" (ADR-00332746)



Reply all
Reply to author
Forward
0 new messages