How to add radius / proximity around the city for traffic estimation (Google Adwords)?

For the project, I'm busy with the Google Adwords api (client library = C #). I show the visitor an estimate of traffic based on keywords and the current location / city. He uses the following method

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

I want to add an additional requirement: the assessment should contain a proximity (radius) of 15 kilometers in the vicinity / city. I tried adding proximity to the campaignestimator object, but then an error occurred based on the response.

Piece of code

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

An 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?

Thank you very much.

Geordie

+6
source share
2 answers

The problem is that the CampaignEstimateRequest criteria can only be of two types: Language and Location , and you are trying to pass the Proximity type.

In addition, Proximity only works (apparently) in the AdX API, which I suspect you are not using.

You may need to calculate your results based on location, install in your target city, and then manually delete everything that is not in the radius.

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

How to check if some coordinates fall into another coordinate radius using only PHP

But you need to convert it to C #.

+1
source

I think you need to use proximity. The code for creating a proximity target is similar to how you add a location target, except that you need to create a Proximity object instead of a Location object.

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

Good luck

0
source

All Articles