Alex: Please be notified that you have to remove unwanted targets before adding the new ones. You cannot use operator SET to update targets for CampaignCriterionOperation.
On Jan 17, 10:01 am, Minh Le <[email protected]> wrote: > Don't try to use ProximityTarget when it is not supported in v201109. > You should use Proximity instead. > I don't know what programming language you're using, but you can take > a look at these snippets in C#: > > List<CampaignCriterion> criteria = new > List<CampaignCriterion>(); > > //Language criterion > Language language1 = new Language(); > language1.id = 1000; // > Englishhttp://code.google.com/apis/adwords/docs/appendix/languagecodes.html > CampaignCriterion languageCriterion = new > CampaignCriterion(); > languageCriterion.campaignId = xxxCampaignId; //put your > campaign ID here > languageCriterion.criterion = language1; > criteria.Add(languageCriterion); > > //Location criterion > Location location = new Location(); > location.id = xxxCriteriaID; //US > Cities:http://code.google.com/apis/adwords/docs/appendix/cities_us.html > CampaignCriterion locationCriterion = new > CampaignCriterion(); > locationCriterion.campaignId = xxxCampaignId //put your > campaign ID here > locationCriterion.criterion = location; > criteria.Add(locationCriterion); > > //Proximity > CampaignCriterion proximityCriterion = new > CampaignCriterion(); > proximityCriterion.campaignId = xxxCampaignId; //put your > campaign ID here > proximityCriterion.criterion = xxxProximity; //put your > proximity target here > criteria.Add(proximityCriterion); > > You can create the proximity targets by the way you did before. They > are something like this: > > Proximity newTarget = new Proximity(); > ... > GeoPoint geoPoint = new GeoPoint(); > geoPoint.latitudeInMicroDegrees = xxx; > geoPoint.longitudeInMicroDegrees = xxx; > > newTarget.geoPoint = geoPoint; > newTarget.radiusDistanceUnits = > ProximityDistanceUnits.KILOMETERS; > newTarget.radiusInUnits = xxx; > > On Jan 13, 7:27 pm, Alex Tran <[email protected]> wrote: > > > > > > > > > Hi Minh Le, > > Do you know how to add each of the proximity targets to each of the > > CampaignCriterion? ProximityTarget object has been removed in new > > version 201109. > > > On Jan 14, 12:45 am, Minh Le <[email protected]> wrote: > > > > - Create a list of Proximity > > > - Create a list of CampaignCriterion, add each of the proximity > > > targets to each of the CampaignCriterion > > > - Use this function (C#) > > > > public static void addCampaignCriteria(AdWordsUser user, > > > long campaignId, CampaignCriterion[] criteria, > > > CampaignCriterionService campaignCriterionService) > > > { > > > List<CampaignCriterionOperation> operations = > > > new List<CampaignCriterionOperation>(); > > > > foreach (CampaignCriterion criterion in criteria) > > > { > > > CampaignCriterionOperation operation = > > > new CampaignCriterionOperation(); > > > operation.@operator = Operator.ADD; > > > operation.operand = criterion; > > > operations.Add(operation); > > > } > > > > try > > > { > > > CampaignCriterionReturnValue retVal = > > > campaignCriterionService.mutate(operations.ToArray()); > > > > //display added criteria > > > if (retVal != null && retVal.value != null > > > && retVal.value.Length > 0) > > > { > > > foreach (CampaignCriterion temp in retVal.value) > > > { > > > Console.WriteLine("Campaign criterion with > > > campaign id = \"{0}\", criterion id = " + > > > "\"{1}\" and type = > > > \"{2}\" was added.", > > > temp.campaignId, > > > temp.criterion.id, > > > > temp.criterion.CriterionType); > > > } > > > } > > > else > > > { > > > Console.WriteLine("No campaign criteria were > > > added."); > > > } > > > } > > > catch (Exception ex) { } > > > } > > > > On Jan 13, 1:42 am, Alex Tran <[email protected]> wrote: > > > > > Withversion200909, I used ProximityTarget + GeoTarget + > > > > GeoTargetList + GeoTargetOperation to add GeoLocation to Campaign. > > > > Now I want to upgrade toversion201109, and I dug all the document > > > > but dont know how to do that with thisversion. > > > > > (I need to expand 300geolocations limit) > > > > > Please give me a hand. > > > > Thank you -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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
