Problem with Batch Targeting Criteria when adding Tailored Audience

targeting

#1

I have encountered another bug with the batch targeting criteria endpoint, specifically with Tailored Audiences. Once an excluded tailored audience target is created, you are never able to add that tailored audience as an included target, even after you delete the original excluded target

Here is a scenario to help illustrate:

  1. I add an Excluded Tailored Audience target to my line item:
twurl -X POST -r '[{"operation_type":"Create","params": {"line_item_id":"8dqoj","targeting_type":"TAILORED_AUDIENCE","targeting_value":"v0ss","operator_type":"NE"}}]' -A 'Content-Type: application/json' -H 'ads-api.twitter.com' '/1/batch/accounts/XXXXXX/targeting_criteria' | jq
{
  "data_type": "targeting_criterion",
  "data": [
    {
      "line_item_id": "8dqoj",
      "name": "Custom audience targeting",
      "id": "dwd61x",
      "tailored_audience_expansion": false,
      "operator_type": "NE",
      "created_at": "2017-06-05T21:38:46Z",
      "targeting_value": "v0ss",
      "updated_at": "2017-06-05T21:38:46Z",
      "tailored_audience_type": "EXCLUDED_CRM",
      "deleted": false,
      "targeting_type": "TAILORED_AUDIENCE"
    }
  ],
  "request": [
    {
      "params": {
        "line_item_id": "8dqoj",
        "account_id": "XXXXXX",
        "operator_type": "NE",
        "targeting_value": "v0ss",
        "targeting_type": "TAILORED_AUDIENCE"
      },
      "operation_type": "Create"
    }
  ]
}
  1. I change my mind and remove the tailored audience target I just created:
 twurl -X POST -r '[{"operation_type": "Delete","params": {"line_item_id": "8dqoj","targeting_criterion_id": "dwd61x"}}]' -A 'Content-Type: application/json' -H 'ads-api.twitter.com' '/1/batch/accounts/XXXXXX/targeting_criteria' | jq
{
  "data_type": "targeting_criterion",
  "data": [
    {
      "line_item_id": "8dqoj",
      "name": "Custom audience targeting",
      "id": "dwd61x",
      "tailored_audience_expansion": false,
      "operator_type": "NE",
      "created_at": "2017-06-05T21:38:46Z",
      "targeting_value": "v0ss",
      "updated_at": "2017-06-05T22:05:35Z",
      "tailored_audience_type": "EXCLUDED_CRM",
      "deleted": true,
      "targeting_type": "TAILORED_AUDIENCE"
    }
  ],
  "request": [
    {
      "params": {
        "targeting_criterion_id": "dwd61x",
        "account_id": "XXXXXX"
      },
      "operation_type": "Delete"
    }
  ]
}
  1. Next, I decide that I actually want to include that same tailored audience, so I send a new target create request:
twurl -X POST -r '[{"operation_type":"Create","params": {"line_item_id":"8dqoj","targeting_type":"TAILORED_AUDIENCE","targeting_value":"v0ss","operator_type":"EQ"}}]' -A 'Content-Type: application/json' -H 'ads-api.twitter.com' '/1/batch/accounts/XXXXXX/targeting_criteria' | jq
{
  "data_type": "targeting_criterion",
  "data": [
    {
      "line_item_id": "8dqoj",
      "name": "Custom audience targeting",
      "id": "dwd61x",
      "tailored_audience_expansion": false,
      "operator_type": "NE",
      "created_at": "2017-06-05T21:38:46Z",
      "targeting_value": "v0ss",
      "updated_at": "2017-06-05T22:09:04Z",
      "tailored_audience_type": "EXCLUDED_CRM",
      "deleted": false,
      "targeting_type": "TAILORED_AUDIENCE"
    }
  ],
  "request": [
    {
      "params": {
        "line_item_id": "8dqoj",
        "account_id": "XXXXXX",
        "operator_type": "EQ",
        "targeting_value": "v0ss",
        "targeting_type": "TAILORED_AUDIENCE"
      },
      "operation_type": "Create"
    }
  ]
}

Here is where I encounter the bug. Notice that my request asks to add an included CRM (with the provided "operator_type": "EQ" attribute). The request succeeds, but the target that is created is an EXCLUDED_CRM target.

@juanshishido, can you confirm this on your end?


Problem Excluding Tailored Audience Via Batch Endpoint
#2

@pakrouse: Thanks for the details. The team will investigate. As always, thanks for bringing potential issues to our attention.


#3

@pakrouse: Thanks for bringing this to our attention. We’ve been able to repro.

We’ve also found that this behavior is inconsistent with the POST accounts/:account_id/targeting_criteria endpoint, where it is possible to specify the included audience after deleting the excluded one.

We’ll work toward finding a fix for this. Thanks for your patience.


#4

@pakrouse: I’ve submitted a patch to fix this. I’ll update this thread with additional details once the fix has been deployed.


#5

@pakrouse: The fix has been deployed. The third request, below, now correctly shows "operator_type": "EQ".

Thanks again for raising this.


$ twurl -H ads-api.twitter.com -X POST -A "Content-Type: application/json" -d '[{"operation_type":"Create","params":{"line_item_id":"a7bs8","targeting_type":"TAILORED_AUDIENCE","targeting_value":"1nmth", "operator_type":"NE"}}]' "/2/batch/accounts/18ce54d4x5t/targeting_criteria"
{
  "data": [
    {
      "line_item_id": "a7bs8",
      "name": "Custom audience targeting",
      "id": "hcdtt1",
      "tailored_audience_expansion": false,
      "operator_type": "NE",
      "created_at": "2018-01-18T09:45:19Z",
      "targeting_value": "1nmth",
      "updated_at": "2018-01-18T09:45:19Z",
      "tailored_audience_type": "EXCLUDED_CRM",
      "deleted": false,
      "targeting_type": "TAILORED_AUDIENCE"
    }
  ],
  "request": [
    {
      "params": {
        "line_item_id": "a7bs8",
        "account_id": "18ce54d4x5t",
        "operator_type": "NE",
        "targeting_value": "1nmth",
        "targeting_type": "TAILORED_AUDIENCE"
      },
      "operation_type": "Create"
    }
  ]
}
$ twurl -H ads-api.twitter.com -X POST -A "Content-Type: application/json" -d '[{"operation_type":"Delete","params":{"targeting_criterion_id":"hcdtt1"}}]' "/2/batch/accounts/18ce54d4x5t/targeting_criteria"
{
  "data": [
    {
      "line_item_id": "a7bs8",
      "name": "Custom audience targeting",
      "id": "hcdtt1",
      "tailored_audience_expansion": false,
      "operator_type": "NE",
      "created_at": "2018-01-18T09:45:19Z",
      "targeting_value": "1nmth",
      "updated_at": "2018-01-18T09:45:44Z",
      "tailored_audience_type": "EXCLUDED_CRM",
      "deleted": true,
      "targeting_type": "TAILORED_AUDIENCE"
    }
  ],
  "request": [
    {
      "params": {
        "targeting_criterion_id": "hcdtt1",
        "account_id": "18ce54d4x5t"
      },
      "operation_type": "Delete"
    }
  ]
}
$ twurl -H ads-api.twitter.com -X POST -A "Content-Type: application/json" -d '[{"operation_type":"Create","params":{"line_item_id":"a7bs8","targeting_type":"TAILORED_AUDIENCE","targeting_value":"1nmth", "operator_type":"EQ"}}]' "/2/batch/accounts/18ce54d4x5t/targeting_criteria"
{
  "data": [
    {
      "line_item_id": "a7bs8",
      "name": "Custom audience targeting",
      "id": "hcdtt1",
      "tailored_audience_expansion": false,
      "operator_type": "EQ",
      "created_at": "2018-01-18T09:45:19Z",
      "targeting_value": "1nmth",
      "updated_at": "2018-01-18T09:46:15Z",
      "tailored_audience_type": "CRM",
      "deleted": false,
      "targeting_type": "TAILORED_AUDIENCE"
    }
  ],
  "request": [
    {
      "params": {
        "line_item_id": "a7bs8",
        "account_id": "18ce54d4x5t",
        "operator_type": "EQ",
        "targeting_value": "1nmth",
        "targeting_type": "TAILORED_AUDIENCE"
      },
      "operation_type": "Create"
    }
  ]
}

#6

Looks good, thanks for the fix @juanshishido.