update demographic criteria like gender or age range

93 views
Skip to first unread message

akash magar

unread,
Aug 3, 2018, 1:11:29 AM8/3/18
to AdWords API and Google Ads API Forum
hi 
I am new to adwords api and i want to know how to update demographics criteria like gender and range as a examples given in samples section I write below code but I don't know what exactly happens

here is my code sample

$genderTarget = new Gender();
                        $genderTarget -> setId( 11 );

                        $genderBiddableAdGroupCriterion = new BiddableAdGroupCriterion();
                        $genderBiddableAdGroupCriterion -> setAdGroupId( $adGroupId );
                        $genderBiddableAdGroupCriterion -> setCriterion( $genderTarget );

                        $genderBiddableAdGroupCriterionOperation = new AdGroupCriterionOperation();
                        $genderBiddableAdGroupCriterionOperation -> setOperand( $genderBiddableAdGroupCriterion );
                        $genderBiddableAdGroupCriterionOperation -> setOperator( Operator::SET );
                        $operations[] = $genderBiddableAdGroupCriterionOperation;


                $result = $adGroupCriterionService -> mutate( $operations );

it gives me error like
AdGroupCriterionError.CANT_UPDATE_NEGATIVE @ operations[0].operand

and when I set Operator to ADD it gives me error as 
AdGroupCriterionError.CANNOT_TARGET_AND_EXCLUDE @ operations[0].operand

so can anyone tell me what exactly wrong i am doing.


Luis Xander Talag (AdWords API Team)

unread,
Aug 3, 2018, 4:03:21 AM8/3/18
to AdWords API and Google Ads API Forum
Hi Akash,

The AdGroupCriterionError.CANT_UPDATE_NEGATIVE error you encountered means that you cannot update the negative criteria. You could only add or exclude the gender criteria in the Ad Group with Display Network only campaign type. You may check this guide for more information on criteria usage. However, to further investigate your issue, could you provide the complete SOAP request and response logs when you encountered the AdGroupCriterionError.CANT_UPDATE_NEGATIVE and AdGroupCriterionError.CANNOT_TARGET_AND_EXCLUDE errors? Please reply via Reply privately to author.

Thanks and regards,
Luis
AdWords API Team
Reply all
Reply to author
Forward
0 new messages