Retrive location ids from latitude and longitude

309 views
Skip to first unread message

kushani hansika

unread,
Oct 11, 2022, 7:51:07 AM10/11/22
to Google Ads API and AdWords API Forum
Hi,

I want to create buildTargetLocationCriterion for the campaign. Is there any method to get location Ids using latitude and longitudes in Google Ads API?? 

Here is my code...

private static CampaignCriterion buildTargetLocationCriterion(
long locationId, String campaignResourceName, boolean target) {

CampaignCriterion.Builder builder = CampaignCriterion.newBuilder().setCampaign(campaignResourceName).setNegative(target);

builder.getLocationBuilder().setGeoTargetConstant(ResourceNames.geoTargetConstant(locationId));

return builder.build();
}


Thanks & Best Regards,
Kushani Hansika

Google Ads API Forum Advisor

unread,
Oct 11, 2022, 10:20:58 AM10/11/22
to wakhans...@gmail.com, adwor...@googlegroups.com
Hi Kushani,

Thank you for reaching us out. I am Sherwin from Google Ads API support team. I hope that you are doing well today.

I understand that you want to get the location ID using coordinates. Please note that using of coordinates to get the location ID is not yet available. Currently, in the Google Ads API, you can query geo location details using the https://developers.google.com/google-ads/api/fields/v11/geo_target_constant?hl=en. You can also use the location_view report and add the campaign_criterion.proximity.radius if you are looking for criterion id.

Please let us know if this works for you.

Kind regards,
Google Logo
Sherwin Vincent
Google Ads API Team
 


ref:_00D1U1174p._5004Q2f4rmO:ref
Reply all
Reply to author
Forward
0 new messages