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
Selecting a radiusFrom the page menu on the left, click Locations. Click the name of the campaign that you wish to edit. Click the blue pencil icon, then select Radius. In the search box, enter the address of the location that you'd like to use for the centre of the radius.
Location is typically based on the Internet Protocol (IP) address, which is a unique number assigned by Internet Service Providers to each computer connected to the Internet. If a device is connected to a Wi-Fi network, we may detect the Wi-Fi network's IP address to determine physical location.
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#.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With