Querying location ID by city name

47 views
Skip to first unread message

Oren

unread,
Sep 12, 2017, 11:26:53 AM9/12/17
to AdWords Scripts Forum
Hi,

I'm trying to create a campaign which is targeted to a specific city.

Is there a way in AdWords Scripts to query the location ID by the city name (to then use in campaign.addLocation())?

Any sample i've come acrross references the AdWords API Geotargeting list, or the AdWords API LocationCriterionService, but I'm not clear on how to use these in AdWords Scripts.

Thanks!
Oren

Anthony Madrigal

unread,
Sep 12, 2017, 11:38:46 AM9/12/17
to AdWords Scripts Forum
Hi Oren,

Unfortunately, there is no currently no service similar to the LocationCriterionService in AdWords API that will allow you to query the location Id by the city name. You will need to find the Id from the geotargeting list then pass that to the addLocation function. 

If, however, one of your campaigns is already targeting that location, you can retrieve the location then use getId to grab the location Id which you can then use to add the location to your desired campaign.

Regards,
Anthony
AdWords Scripts Team
Reply all
Reply to author
Forward
0 new messages