Campaign Location Settings: Radius (GET)

89 views
Skip to first unread message

Derek T

unread,
Nov 8, 2017, 1:05:15 PM11/8/17
to AdWords API Forum
I'm attempting to recreate the basic functionality in the Campaign > Locations section, specifically with specifying a radius.  After some digging it looks like I should be using the Proximity Criteria Type in the CampaignCriterionService, but when I retrieve the list from the criteria, the Address block is mostly empty.  All that I receive is provinceName.  My current campaign settings specify a radius of x-Miles for a specific zip code.  I'd expect to see postalCode returned with the provinceName.

Here's a snippet for my C# implementation:

var campaignService = (CampaignCriterionService)request.AdWordsUser.GetService(AdWordsService.v201705.CampaignCriterionService);


var campaignLocationPage = campaignService.get(new Selector
{
    fields
= new string[]
   
{
       
Criterion.SelectableFields.Id,
       
Criterion.SelectableFields.CriteriaType,
       
Proximity.SelectableFields.Address,
       
Proximity.SelectableFields.GeoPoint,
       
Proximity.SelectableFields.RadiusDistanceUnits,
       
Proximity.SelectableFields.RadiusInUnits
   
},
    predicates
= new Predicate[]
   
{
       
new Predicate
       
{
            field
= Criterion.FilterableFields.CriteriaType,
           
@operator = PredicateOperator.EQUALS,
            values
= new string[] { CriterionType.PROXIMITY.ToString() }
       
},
       
new Predicate
       
{
            field
= "CampaignId",
           
@operator = PredicateOperator.IN,
            values
= request.CampaignIdList.Select(x => x.ToString()).ToArray() // This is just a list of campaign IDs converted into an array of strings
       
}
   
}
});

I've found other posts where this type of query settings are recommended, but they don't show full code snippets, or address the issue of an empty Address.

I've gone so far as to try to hard-code the names of the Address fields in my Selector's fields, (ex: "PostalCode" or "POSTALCODE") and received an error back from the API, stating that the field name is invalid.

Thank you in advance.  Any help would be greatly appreciated!

Shwetha Vastrad (AdWords API Team)

unread,
Nov 8, 2017, 3:57:00 PM11/8/17
to AdWords API Forum
Hi Derek, 

Depending on the way you created the Proximity Criterion, the address may or may not be populated. If you explicitly provided the address in the Proximity object, then you can retrieve the details using CampaignCriterionService.get() by including the field "Address" in the selector. If you created the Proximity criterion by specifying a geoPoint, then the address may be returned as null if unknown. If you are specifying the address but not receiving it in the response, please enable logging and provide the SOAP request and response logs so I can take a look. Please use Reply privately to author when responding. 

Regards,
Shwetha, AdWords API Team.

Derek T

unread,
Nov 8, 2017, 5:38:27 PM11/8/17
to AdWords API Forum
Thank you for the response, Shwetha!

In my case, I created it from the AdWords UI.

What I specified was the following:

20.0 mi around Sunrise, FL

I receive the values for 20, Miles and Florida.  I don't receive "Sunrise".  So when I'm trying to use the information returned as part of my API implementation, It would not be the same value that you see in AdWords.  Instead, all I would be able to say is "20.0 mi around FL".  I guess my question is how to obtain the value "Sunrise," in this case?

Shwetha Vastrad (AdWords API Team)

unread,
Nov 9, 2017, 11:06:12 AM11/9/17
to AdWords API Forum
Hi Derek, 

I'll get in touch with the team to provide more details in the Address returned for Proximity criteria. Meanwhile, you can use the reverse geocoding to retrieve the location details using the latitude/longitude returned in the geoPoint. Please note that the latitude and longitude will be in Micro degrees. 

Derek T

unread,
Nov 13, 2017, 10:19:47 AM11/13/17
to AdWords API Forum
Thank you for the pointer!  I'll look into this ASAP.

Have a great day!
Reply all
Reply to author
Forward
0 new messages