Confused by error message on targeting_criteria



I thought I had a pretty good handle on the campaign create flow until I hit this snag on targeting_critera.

I have prepared a tailored audience based on Site Visit web event. I get this ID "1g1ln" from the GET tailored_audiences endpoint and see that it is associated with my webevent.

When I try to create targeting_criteria associating my dynamic ad campaign line_item with a targeting_type TAILORED_AUDIENCE and targeting_value 1g1ln, the targeting_criteria endpoint replies with:

"Expected Long, got "1g1ln" for targeting_value"

I’ve not run into any objects on any ads api endpoint with Long as a the ID data type. Can someone point me to where I am supposed to get the correct targeting_value from?

I’m following the example on the Dynamic Ads targeting section, which shows an ID, "w1dv" being applied as the targeting_value for a TAILORED_AUDIENCE targeting type.


Hi, @azPHPguru. Thanks for your question. Sounds like you’re doing all the right things—e.g., using the GET accounts/:account_id/tailored_audiences endpoint to find the ID and following the example.

Did you only see the INVALID_PARAMETER error? Or did you also get:

  "message": "Tailored audience type is required in tailored audience targeting.",
  "parameter": ""

With tailored audience targeting criteria, in addition to specifying the targeting_type and the targeting_value, you must also include tailored_audience_type. Below is an example request for adding tailored audience targeting to a line item.

$ twurl -X POST -H "/1/accounts/xxxxx/targeting_criteria?line_item_id=aaaa&targeting_type=TAILORED_AUDIENCE&targeting_value={tailored_audience_id}&tailored_audience_type=WEB"

Please let us know if adding tailored_audience_type resolves this issue. Thanks!


Ah yes, I discovered that I had forgotten the type and in this case the default error message was returned for the field. While misleading, I was also only looking at the 0th error of a 2-node error reply. So in the end I figured it out and it works properly as documented when all required parameters are sent in the request.



Glad to hear you resolved this!