Location Id for a country

2,081 views
Skip to first unread message

Amritpal Singh

unread,
Feb 27, 2023, 6:45:22 AM2/27/23
to Google Ads API and AdWords API Forum
Hey, I am using the google ads api to fetch the relevant keywords. In this we need to provide location_ids for targeting a particular area. My question is that is there any way we can get location id for a whole country rather than any cities in that. 

In the csv file I can find locations but there are different Criteria IDs for different cities in a country. How can I find location id for a country which contains all the cities. For eg. can I get single Criteria ID for India country as a whole?

Google Ads API Forum Advisor

unread,
Feb 27, 2023, 3:37:08 PM2/27/23
to matharoo...@gmail.com, adwor...@googlegroups.com

Hi Amritpal,

Thanks for reaching out to the Google Ads API Forum.

I see that you have concerns regarding finding the location id for a country which contains all the cities. you may use the Campaign Criterion resource, more specifically in your question is the location. You may use the geo_target_constant report. You may see the GAQL below:

SELECT geo_target_constant.canonical_name, geo_target_constant.country_code, geo_target_constant.id, geo_target_constant.name, geo_target_constant.parent_geo_target, geo_target_constant.resource_name, geo_target_constant.status, geo_target_constant.target_type FROM geo_target_constant WHERE geo_target_constant.country_code = 'IN'

Results:

{

      "geoTargetConstant": {

        "status": "ENABLED",

        "targetType": "Country",

        "name": "India",

        "countryCode": "IN",

        "canonicalName": "India",

        "resourceName": "geoTargetConstants/2356",

        "id": "2356"

      }

    },

    {

      "geoTargetConstant": {

        "status": "ENABLED",

        "targetType": "Union Territory",

        "name": "Andaman and Nicobar Islands",

        "countryCode": "IN",

        "canonicalName": "Andaman and Nicobar Islands,India",

        "parentGeoTarget": "geoTargetConstants/2356",

        "resourceName": "geoTargetConstants/20452",

        "id": "20452"

      }

    },

    {

      "geoTargetConstant": {

        "status": "ENABLED",

        "targetType": "State",

        "name": "Andhra Pradesh",

        "countryCode": "IN",

        "canonicalName": "Andhra Pradesh,India",

        "parentGeoTarget": "geoTargetConstants/2356",

        "resourceName": "geoTargetConstants/20453",

        "id": "20453"

      }

    },

    :

    :

 

As you can see above, geoTargetConstants/2356 is for India which has targetType as a country. I hope this helps.

Regards,

Google Logo Google Ads API Team

 



ref:_00D1U1174p._5004Q2jH6B7:ref

Amritpal Singh

unread,
Feb 28, 2023, 11:42:29 PM2/28/23
to Google Ads API Forum Advisor, adwor...@googlegroups.com
Thanks a lot. 
Reply all
Reply to author
Forward
0 new messages