Hello,
first of all i want to apologize for my bad english.
I've got a problem. When i try to locate a campaing to a
proximityTarget it sometimes works and sometimes not.
The tests only differs in the address itself.
For example to addresses:
This one don't work:
$address = new Address();
$address->streetAddress = 'Großneumarkt 10';
$address->cityName = 'Hamburg';
$address->provinceCode ='DE-HH';
$address->postalCode = '20249';
$address->countryCode = 'DE';
but this one works (and its really not that known as Hamburg):
$address = new Address();
$address->streetAddress = 'Im Dachsstück 9';
$address->cityName = 'Limburg';
$address->provinceCode ='DE-HE';
$address->postalCode = '65549';
$address->countryCode = 'DE';
And if i leave $address->provinceCode out it also works, but only with
the second address.
The error I get is allways: INVALID_REGIONCODE_LENGTH
But how can this be possible? I checked the provinceCode several times
and as allready said it also works without this variable in some
cases.
i don't know wheter this helps you, but i post the rest of the
dependent code:
// Get the GeoLocationService.
$geoLocationService = $user->GetGeoLocationService('v201008');
// Create geo location selector.
$selector = new GeoLocationSelector();
$selector->addresses = array($address);
// Get geo location.
$result = $geoLocationService->get($selector);
$geoLocation = $result[0];
//City Target
$cityTarget = new ProximityTarget();
$cityTarget->geoPoint = $geoLocation->geoPoint;
$cityTarget->radiusDistanceUnits = 'KILOMETERS';
$cityTarget->radiusInUnits = $termin->umkreis;
$cityTarget->address = $geoLocation->address;
//$cityTarget = new CityTarget();
//$cityTarget->cityName = 'Limburg';
//$cityTarget->countryCode = 'DE';
// Create geo targets.
$geoTargetList = new GeoTargetList();
$geoTargetList->campaignId = $campaignId;
$geoTargetList->targets =
array($cityTarget);
// Create network targets.
$networkTargetList = new NetworkTargetList();
$networkTargetList->campaignId = $campaignId;
// Specifying GOOGLE_SEARCH is necessary if you want to target
SEARCH_NETWORK.
$networkTargetList->targets = array(
new NetworkTarget('GOOGLE_SEARCH'));
// Create operations.
$langTargetOperation = new CampaignTargetOperation();
$langTargetOperation->operand = $langTargetList;
$langTargetOperation->operator = 'SET';
$geoTargetOperation = new CampaignTargetOperation();
$geoTargetOperation->operand = $geoTargetList;
$geoTargetOperation->operator = 'SET';
$networkTargetOperation = new CampaignTargetOperation();
$networkTargetOperation->operand = $networkTargetList;
$networkTargetOperation->operator = 'SET';
$operations = array($langTargetOperation, $geoTargetOperation,
$networkTargetOperation);
// Set campaign targets.
$result = $campaignTargetService->mutate($operations);
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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