Hi, If you create radius targeting through the UI, you'll see that you get a Proximity object as I described. For example, I used the UI to create radius targeting around two areas in my campaign: postal code 11215, and Paris, France. This resulted in the CampaignCriterion list shown at the end of this message.
You could achieve the same thing through the API by using GeoLocationService to find the latitude & longitude for the partial address of interest. For example, for Paris, France, you'd submit a GeoLocationService request where you just populated cityName <https://developers.google.com/adwords/api/docs/reference/v201402/GeoLocationService.Address#cityName> = "Paris" and countryCode <https://developers.google.com/adwords/api/docs/reference/v201402/GeoLocationService.Address#countryCode> = "FR". <selector> <addresses> <cityName>Paris</cityName> <countryCode>FR</countryCode> </addresses> </selector> This would give you: <getResponse xmlns="https://adwords.google.com/api/adwords/cm/v201402"> <rval> <geoPoint> <latitudeInMicroDegrees>48856614</latitudeInMicroDegrees> <longitudeInMicroDegrees>2352221</longitudeInMicroDegrees> </geoPoint> <address> <cityName>Paris</cityName> <countryCode>FR</countryCode> </address> <encodedLocation>...</encodedLocation> <GeoLocation.Type>GeoLocation</GeoLocation.Type> </rval> </getResponse> You could then use that GeoPoint to construct your Proximity object. Regards, Josh, AdWords API Team <entries> <campaignId>xxx</campaignId> <isNegative>false</isNegative> <criterion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Proximity"> <id>95050702855</id> <type>PROXIMITY</type> <Criterion.Type>Proximity</Criterion.Type> <geoPoint> <latitudeInMicroDegrees>40683006</latitudeInMicroDegrees> <longitudeInMicroDegrees>-73980064</longitudeInMicroDegrees> </geoPoint> <radiusDistanceUnits>KILOMETERS</radiusDistanceUnits> <radiusInUnits>20.0</radiusInUnits> <address> <cityName>Brooklyn</cityName> <provinceName>NY</provinceName> <postalCode>11215</postalCode> <countryCode>US</countryCode> </address> </criterion> <CampaignCriterion.Type>CampaignCriterion</CampaignCriterion.Type> </entries> <entries> <campaignId>xxx</campaignId> <isNegative>false</isNegative> <criterion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Proximity"> <id>98646096895</id> <type>PROXIMITY</type> <Criterion.Type>Proximity</Criterion.Type> <geoPoint> <latitudeInMicroDegrees>48856614</latitudeInMicroDegrees> <longitudeInMicroDegrees>2352221</longitudeInMicroDegrees> </geoPoint> <radiusDistanceUnits>MILES</radiusDistanceUnits> <radiusInUnits>20.0</radiusInUnits> <address> <cityName>Paris</cityName> <countryCode>FR</countryCode> </address> </criterion> <CampaignCriterion.Type>CampaignCriterion</CampaignCriterion.Type> </entries> On Monday, August 4, 2014 3:55:50 PM UTC-4, Dzmitry Zahusta wrote: > > Hi, > > The problem with GeoLocationService > <https://developers.google.com/adwords/api/docs/reference/v201406/GeoLocationService> > is > that it returns an array of GeoLocation > <https://developers.google.com/adwords/api/docs/reference/v201406/GeoLocationService.GeoLocation.html> > . > > For example, even in US there are several cities with the same name - try > "Paris" or "London". And if with criteria id I can uniquely choose the > proper city, I have no idea how to choose the proper one (that correspond > to the same city identified by criteria id) using GeoLocationService > <https://developers.google.com/adwords/api/docs/reference/v201406/GeoLocationService> > . > > Do you know any solution? > > понедельник, 4 августа 2014 г., 21:18:48 UTC+3 пользователь Josh Radcliff > (AdWords API Team) написал: >> >> Hi, >> >> Proximity criteria is the only way to do radius targeting through the >> API. Note that you can look up the *GeoPoint* that corresponds to an >> address (including a partial address, e.g., one based solely on >> postalCode >> <https://developers.google.com/adwords/api/docs/reference/v201406/GeoLocationService.Address#postalCode>) >> >> using GeoLocationService >> <https://developers.google.com/adwords/api/docs/reference/v201406/GeoLocationService>. >> >> Once you have the *GeoPoint*, you can then use that to construct your >> *Proximity* object. >> >> A similar concept is LocationGroups >> <https://developers.google.com/adwords/api/docs/reference/v201406/CampaignCriterionService.LocationGroups>, >> >> which allow you to target areas or demographic groups near one or more >> locations. See the AddCampaignTargetingCriteria.java >> <https://github.com/googleads/googleads-java-lib/blob/master/examples/adwords_axis/src/main/java/adwords/axis/v201406/targeting/AddCampaignTargetingCriteria.java#L114> >> example >> in each client library's *targeting* folder for details. >> >> Thanks, >> Josh, AdWords API Team >> >> On Monday, August 4, 2014 1:50:12 PM UTC-4, Dzmitry Zahusta wrote: >>> >>> Hi Josh! >>> >>> I don't think this is right way. To add Location you need to know its >>> criteria id (for example 21137L - California). But to add Proximity you >>> need to know the proper address or lattitude and longitude. And there is no >>> way to map criteria id to some address or retrieve its GeoPoint to set to >>> Proximity. In other words - I want to get the same object to set for >>> LocationCriterion and Proximity. >>> >>> My thought is if it's possible in UI it should be possible in the code. >>> >>> понедельник, 4 августа 2014 г., 19:17:17 UTC+3 пользователь Josh >>> Radcliff (AdWords API Team) написал: >>> >>>> Hi, >>>> >>>> You can do this using a Proximity >>>> <https://developers.google.com/adwords/api/docs/reference/v201406/CampaignCriterionService.Proximity> >>>> campaign >>>> criterion. See our Location Targeting Guide >>>> <https://developers.google.com/adwords/api/docs/guides/location-targeting#proximity-targeting> >>>> for >>>> more details. >>>> >>>> Cheers, >>>> Josh, AdWords API Team >>>> >>>> On Monday, August 4, 2014 11:36:00 AM UTC-4, Dzmitry Zahusta wrote: >>>>> >>>>> Hi here! >>>>> >>>>> How is it possible to add locations with radius programmatically as I >>>>> can do it using UI: >>>>> >>>>> >>>>> <https://lh6.googleusercontent.com/-oFfRBlWc5dI/U9-nhjAcUMI/AAAAAAABPnU/FT88U9MSisU/s1600/Locations.png> >>>>> Thank you in advance >>>>> >>>> -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and Google+: https://googleadsdeveloper.blogspot.com/ https://plus.google.com/+GoogleAdsDevelopers/posts =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
