Campaign criterion error

88 views
Skip to first unread message

adatestaccount

unread,
Sep 12, 2023, 7:57:52 AM9/12/23
to Google Ads API and AdWords API Forum
Hi,

I am trying to set a campaign criterion, but getting an error.
code:

  // Construct payload for gender criterion
  var payload = {
    "operations": [
      {
        "create": {
          "campaign": "customers/" + customer_id + "/campaigns/" + campaignId,
          "gender": {
            "type": genderType // For example, MALE or FEMALE
          },
          "status": "ENABLED" // For example, "PAUSED" or "ENABLED"
        }
      }
    ]
  };

error:

Failed to create gender criterion. Response: { "error": { "code": 400, "message": "Request contains an invalid argument.", "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.ads.googleads.v14.errors.GoogleAdsFailure", "errors": [ { "errorCode": { "criterionError": "FIELD_INCOMPATIBLE_WITH_NEGATIVE_TARGETING" }, "message": "The field is not allowed to be set when the negative field is set to true, for example, we don't allow bids in negative ad group or campaign criteria.", "location": { "fieldPathElements": [ { "fieldName": "operations", "index": 0 }, { "fieldName": "create" }, { "fieldName": "gender" } ] } } ], "requestId": "4cnl0nuuZLJJWJl9ZWwxwg" } ] } } The error persists even though I include the negative field and set it to false. please look into it. Thank you

Google Ads API Forum Advisor

unread,
Sep 13, 2023, 3:07:40 AM9/13/23
to adaaut...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

After reviewing your concern, I understand that you are getting the CriterionError. Could you please provide us the complete API logs (request and response with request-id and request header) generated at your end to assist you further.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java.NetPHPPythonRuby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

 
This message is in relation to case "ref:_00D1U1174p._5004Q2okXYb:ref"

Thanks,
 
Google Logo Google Ads API Team


 

Google Ads API Forum Advisor

unread,
Sep 13, 2023, 3:18:17 AM9/13/23
to adwor...@googlegroups.com, adaaut...@gmail.com
Hi,

Thank you for reaching out to the Google Ads API support team. Please ignore my previous response.


After reviewing your concern, I understand that you are getting the CriterionError. Could you please provide us the complete API logs (request and response with request-id and request header) generated at your end to assist you further.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java.NetPHPPythonRuby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.
Reply all
Reply to author
Forward
0 new messages