Thank you Jim for your reply!
I've just modified my code trough the way indicated by you:
$campaignCriterionService = $user->GetService('CampaignCriterionService',
'v201109');
$campaignCriteria = array();
$provincia = array();
foreach ($id_camp as $id){
//$campaignId = (float) '57171644';
$campaignId = (float) $id;
foreach ($staccate as $provi){
$provincia = new Location();
$provincia->id = (float) $provi['code'];
$campaignCriteria[] = new CampaignCriterion($campaignId, $provincia);
}
// Create operations.
$operations = array();
foreach ($campaignCriteria as $campaignCriterion) {
$operations[] = new CampaignCriterionOperation($campaignCriterion,
'REMOVE');
}
// Make the mutate request.
$result = $campaignCriterionService->mutate($operations);
foreach ($result->value as $campaignCriterion) {
printf("Campaign targeting criterion with id '%s' and type '%s' was "
. "added.\n", $campaignCriterion->criterion->id,
$campaignCriterion->criterion->CriterionType);
}
.............
.................
but I still have a problem: [EntityNotFound.INVALID_ID @
operations[0].operand.criterion; trigger:'20548', EntityNotFound.INVALID_ID
@ operations[1].operand.criterion; trigger:'20553',
EntityNotFound.INVALID_ID @ operations[2].operand.criterion;
trigger:'20572', EntityNotFound.INVALID_ID @
operations[3].operand.criterion; trigger:'20582', EntityNotFound.INVALID_ID
@ operations[4].operand.criterion; trigger:'20587',
EntityNotFound.INVALID_ID @ operations[5].operand.criterion;
trigger:'20616', EntityNotFound.INVALID_ID @
operations[6].operand.criterion; trigger:'20520', EntityNotFound.INVALID_ID
@ operations[7].operand.criterion; trigger:'20537',
EntityNotFound.INVALID_ID @ operations[8].operand.criterion;
trigger:'20535', EntityNotFound.INVALID_ID @
operations[9].operand.criterion; trigger:'20542', EntityNotFound.INVALID_ID
@ operations[10].operand.criterion; trigger:'20541',
EntityNotFound.INVALID_ID @ operations[11].operand.criterion;
trigger:'20546', EntityNotFound.INVALID_ID @
operations[12].operand.criterion; trigger:'20560',
EntityNotFound.INVALID_ID @ operations[13].operand.criterion;
trigger:'20549', EntityNotFound.INVALID_ID @
operations[14].operand.criterion; trigger:'20554',
EntityNotFound.INVALID_ID @ operations[15].operand.criterion;
trigger:'20555', EntityNotFound.INVALID_ID @
operations[16].operand.criterion; trigger:'20525',
EntityNotFound.INVALID_ID @ operations[17].operand.criterion;
trigger:'20565', EntityNotFound.INVALID_ID @
operations[18].operand.criterion; trigger:'20562',
EntityNotFound.INVALID_ID @ operations[19].operand.criterion;
trigger:'20573', EntityNotFound.INVALID_ID @
operations[20].operand.criterion; trigger:'20568',
EntityNotFound.INVALID_ID @ operations[21].operand.criterion;
trigger:'20574', EntityNotFound.INVALID_ID @
operations[22].operand.criterion; trigger:'20578',
EntityNotFound.INVALID_ID @ operations[23].operand.criterion;
trigger:'20587', EntityNotFound.INVALID_ID @
operations[24].operand.criterion; trigger:'20590',
EntityNotFound.INVALID_ID @ operations[26].operand.criterion;
trigger:'20592', EntityNotFound.INVALID_ID @
operations[27].operand.criterion; trigger:'20595',
EntityNotFound.INVALID_ID @ operations[28].operand.criterion;
trigger:'20603', EntityNotFound.INVALID_ID @
operations[29].operand.criterion; trigger:'20606',
EntityNotFound.INVALID_ID @ operations[30].operand.criterion;
trigger:'20607', EntityNotFound.INVALID_ID @
operations[32].operand.criterion; trigger:'20610',
EntityNotFound.INVALID_ID @ operations[33].operand.criterion;
trigger:'21233', EntityNotFound.INVALID_ID @
operations[34].operand.criterion; trigger:'20621']
"Trigger" indicate provinceTarget id code, but I can not understand where the
problem!
On Friday, March 9, 2012 4:54:05 PM UTC+1, Jim McCabe wrote:
>
> Campaign geo targeting has changed quite a bit in v201109.
>
> One big change is that you can't use the SET operator to replace all the
> geo targets in one call. Instead, you have to issue ADD and REMOVE
> operations for the specific geo targets. This means you'll have to compute
> the difference between the existing geo targets and the new state.
>
> Another big change is that most geo targets are specified with a location
> ID. You can ask Google to lookup the location ID for a province, or you
> can just download the IDs
> here<http://code.google.com/apis/adwords/docs/appendix/provincecodes.html>.
> Provinces, states, cities, metro areas, all these use a simple Location
> criterion with a unique location ID. It's simple now but requires a bit of
> change from earlier APIs.
>
> Jim
>
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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