Hi, there
I tried to add age and gender in an adgroup, but i get following error
message: [AdGroupCriterionError.CANNOT_TARGET_AND_EXCLUDE @
operations[0].operand].
I want to set both gender and age in an adgroup at once.
my source example :
[
{
"adGroupId": 38658396945,
"ageIds": [
503001
],
"genderIds": [
11
]
}
]
demographicList.stream().forEach(i -> {
i.getGenderIds().stream().forEach(genderId -> {
Gender gender = new Gender();
gender.setId(genderId);
BiddableAdGroupCriterion genderBiddableAdGroupCriterion = new
BiddableAdGroupCriterion();
genderBiddableAdGroupCriterion.setAdGroupId(i.getAdGroupId());
genderBiddableAdGroupCriterion.setCriterion(gender);
AdGroupCriterionOperation genderAdGroupCriterionOperation = new
AdGroupCriterionOperation();
genderAdGroupCriterionOperation.setOperand(genderBiddableAdGroupCriterion);
genderAdGroupCriterionOperation.setOperator(Operator.ADD);
criterionOperationList.add(genderAdGroupCriterionOperation);
});
i.getAgeIds().stream().forEach(ageId -> {
AgeRange ageRange = new AgeRange();
ageRange.setId(ageId);
BiddableAdGroupCriterion ageBiddableAdGroupCriterion = new
BiddableAdGroupCriterion();
ageBiddableAdGroupCriterion.setAdGroupId(i.getAdGroupId());
ageBiddableAdGroupCriterion.setCriterion(ageRange);
AdGroupCriterionOperation adGroupCriterionOperation = new
AdGroupCriterionOperation();
adGroupCriterionOperation.setOperand(ageBiddableAdGroupCriterion);
adGroupCriterionOperation.setOperator(Operator.ADD);
criterionOperationList.add(adGroupCriterionOperation);
});
});
AdGroupCriterionReturnValue result = adGroupCriterionService
.mutate(criterionOperationList.toArray(new
AdGroupCriterionOperation[criterionOperationList.size()]));
Thank you
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/9a9eca49-64a8-47a0-9529-c054b095f01d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.