'negative' => false is also giving the same error.

On Saturday, February 19, 2022 at 7:05:29 PM UTC+5:30 Ramesh Kolamala wrote:

>
> Hi Luis,
>
> The above code results in exclusion of topic, so I removed 'negative' = 
> true and tried but getting the error, below is my code and error:
>
> *My Code:*
> $topicId = 317;
>     
>     $campaignCriterion = new CampaignCriterion([
>         'topic' => new TopicInfo([
>             'topic_constant' => ResourceNames::forTopicConstant($topicId)
>         ]),
>         'campaign' => $campaignResourceName
>     ]);
>
>     $operations[] = new CampaignCriterionOperation(['create' => 
> $campaignCriterion]);
> *Error:*
> "errorCode": { "criterionError": 
> "FIELD_INCOMPATIBLE_WITH_NEGATIVE_TARGETING" }, "message": "The field is 
> not allowed to be set when the negative field is set to true, e.g. we don't 
> allow bids in negative ad group or campaign criteria.", "location": { 
> "fieldPathElements": [ { "fieldName": "operations", "index": 0 }, { 
> "fieldName": "create" }, { "fieldName": "topic" } ] }
>
> Can you suggest me.
>
> On Tuesday, March 19, 2019 at 11:42:43 AM UTC+5:30 
> googleadsapi...@google.com wrote:
>
>> Hi Martin,
>>
>> When implementing criteria targeting via Google Ads API, all you need to 
>> do is to specify the criteria resource_name like the example stated here 
>> <https://developers.google.com/google-ads/api/docs/targeting/location-targeting#geo_target_campaigns_for_a_region>
>>  in 
>> targeting the location. For UserInterestInfo and TopicInfo, you may refer 
>> below for sample request body. Also, you may refer to this link 
>> <https://developers.google.com/google-ads/api/docs/samples/add-campaign-targeting-criteria#java>
>>  for 
>> complete sample code (also available in other languages that we support) on 
>> how to add campaign targeting criteria as the implementation of adding the 
>> other criteria is quite the same as this example.
>>
>> Sample Request for TopicInfo
>> -------
>> MethodName: 
>> google.ads.googleads.v1.services.CampaignCriterionService/MutateCampaignCriteria
>> Endpoint: googleads.googleapis.com:443
>> Headers: {developer-token=REDACTED, login-customer-id=xxxxxxxxxx, 
>> x-goog-api-client=gl-java/1.8.0_171-google-v7 gapic/ gax/1.35.0 grpc/1.16.1}
>> Body: customer_id: "xxxxxxxxxx"
>> operations {
>>   create {
>>     campaign {
>>       value: "customers/[customer_id]/campaigns/[campaign_id]"
>>     }
>>     negative {
>>       value: true
>>     }
>>     topic {
>>       topic_constant {
>>         value: "topicConstants/958"
>>       }
>>     }
>>   }
>> }
>> Sample Request for UserInterestId
>> -------
>> MethodName: 
>> google.ads.googleads.v1.services.CampaignCriterionService/MutateCampaignCriteria
>> Endpoint: googleads.googleapis.com:443
>> Headers: {developer-token=REDACTED, login-customer-id=xxxxxxxxxx, 
>> x-goog-api-client=gl-java/1.8.0_171-google-v7 gapic/ gax/1.35.0 grpc/1.16.1}
>> Body: customer_id: "xxxxxxxxxx"
>> operations {
>>   create {
>>     campaign {
>>       value: "customers/[customer_id]/campaigns/[campaign_id]"
>>     }
>>     negative {
>>       value: true
>>     }
>>     user_interest {
>>       user_interest_category {
>>         value: "customers/[customer_id]/userInterests/80412"
>>       }
>>     }
>>   }
>> }
>>
>>  
>> Thanks and regards,
>> Luis
>> Google Ads API Team
>>
>>
>> Was your question answered? Please rate your experience with us by taking 
>> a short survey.
>> If not -- reply to this email and tell us what else we can do to help.
>>
>> Take Survey 
>> <https://support.google.com/google-ads/contact/survey_transactional?caseid=3-3324000025726&hl=en&ctx=1>
>>
>> Also find us on our blog and discussion group:
>> http://googleadsdeveloper.blogspot.com/search/label/adwords_api
>> https://developers.google.com/adwords/api/community/
>> On 03/19/19 05:50:39 krishnaki...@gmail.com wrote:
>>
>> So I'm working on migrating from Adwords API to Ads api and I'm struck at 
>> one point, that is Targeting service. I cannot actually Target an Adgroup 
>> using the Ads API with either Topic or UserInterest as there are no 
>> examples available in the client libraries. I know that we have to create 
>> TopicInfo or UserInterestInfo for targeting. But how do we set the 
>> targeting Id or user interest id to the TopicInfo or UserInterestInfo, 
>> there are no setter methods for that.
>>
>> val topicInfo = 
>> TopicInfo.newBuilder().setTopicConstant(StringValue.of("958"))
>>   .build()
>>
>>
>> val interestInfo: UserInterestInfo = UserInterestInfo
>>   .newBuilder()
>>   .setUserInterestCategory(StringValue.of("80412"))
>>   .build()
>>
>>
>> Using the above topicInfo and InterestInfo, google Ads API is failing 
>> while mutating with AdgroupCriterionServiceClient. Help me out.
>>
>> -- 
>> -- 
>> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
>> Also find us on our blog:
>> https://googleadsdeveloper.blogspot.com/
>> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
>>  
>> You received this message because you are subscribed to the Google
>> Groups "AdWords API and Google Ads API Forum" group.
>> To post to this group, send email to adwor...@googlegroups.com
>> To unsubscribe from this group, send email to
>>
>> adwords-api...@googlegroups.com
>>
>>
>> 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 and Google Ads API Forum" group.
>>
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to adwords-api...@googlegroups.com.
>>
>>
>> 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/414e3fc3-8b92-4c64-b7f2-9e2c57f71f50%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/adwords-api/414e3fc3-8b92-4c64-b7f2-9e2c57f71f50%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/61abb80d-26c3-4cbc-a0eb-3281233a4904n%40googlegroups.com.

Reply via email to