6

For a project I'm busy with the Google Adwords api (client library = C#). I show the visitor an estimate of traffic based on keywords and locality/city currently. It's using following method

https://developers.google.com/adwords/api/docs/guides/traffic-estimator-service

I want to add an extra requirement: the estimate must contain a proximity (radius) of 15 kilometers around locality/city s. I tried to add the proximity to the campaignestimator object, but then an error occured based on the response.

Part of the programcode

var proximity = new Proximity
{
    radiusDistanceUnits = ProximityDistanceUnits.KILOMETERS,
    radiusInUnits = seaConfigurationModel.Proximity,
    geoPoint = new GeoPoint()
    {
        latitudeInMicroDegrees = 43633941,
        longitudeInMicroDegrees = -79398718
    }
};
campaignEstimateRequest.criteria = new Criterion[] { languageCriterion, proximity };

Exception:

Unmarshalling Error: cvc-elt.4.2: Cannot resolve 'q2:Proximity' to a type definition for element 'criteria'. 

Does anyone know how to solve this? Do I need another method?

Thanks a lot.

Jordy

Jordy
  • 661
  • 7
  • 26
  • It appears that Proximity only works for AdX too. If you're using TrafficServiceEstimator service, you might not be AdX as that service is disabled for AdX – Russ Clarke Oct 12 '15 at 09:35

2 Answers2

2

The problem is that a CampaignEstimateRequest criteria can only be on of two types, Language and Location, and you're trying to pass a Proximity type.

Also, Proximity only works (apparently) on the AdX API which I suspect you might not be using.

What you might need to do is calculate your results based on a Location, set to your target city and then manually remove anything that isn't in the radius.

I've found one such example of how to calculate the radius inclusion here:

How to check if a certain coordinates fall to another coordinates radius using PHP only

But you'll need to convert that into C#.

Community
  • 1
  • 1
Russ Clarke
  • 17,511
  • 4
  • 41
  • 45
  • What you might need to do is calculate your results based on a Location, set to your target city and then manually remove anything that isn't in the radius. Can you explain that some more? I know locationId (in the object Location I cannot give in longitude and latitude). So I don't know how to solve that. http://code.google.com/apis/adwords/docs/appendix/countrycodes.html – Jordy Oct 12 '15 at 10:37
0

I think the proximity needs to be used. The code to create a proximity target is similar to how you add a location target, except that you have to create a Proximity object instead of a Location object.

Not sure but I think if you set the Proximity object is available in the TrafficEstimatorService. However if so you can set a radius. Check out the following URL: https://developers.google.com/adwords/api/docs/guides/location-targeting

Good luck!

Milo
  • 1