Facebook Ads API错误:必须是有效的自定义受众ID [英] Facebook Ads API error: must be a valid custom audience id

查看:116
本文介绍了Facebook Ads API错误:必须是有效的自定义受众ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与定位custom audience不同,似乎不可能使用saved audience的广告. 9"rel =" noreferrer> Facebook Ads API .有人可以确认情况吗?有什么解决方法?这是我得到的错误:

Unlike targeting a custom audience, it seems impossible to create an ad targeting a saved audience using Facebook Ads API. Can someone confirm that is the case? What would be a workaround? This is the error I'm getting:

Error #100: Param targeting[custom_audiences][id] must be a valid custom audience id

saved audiencecustom audience之间存在差异. saved audience是您手动创建的受众群体,用于指定年龄范围,地理区域和兴趣. custom audience是您收集的客户列表(上载或访问者或您的站点等).您可以通过广告管理器界面手动创建这些受众群体:

There is a difference between a saved audience and a custom audience. A saved audience is an audience you manually create specifying age range, geographic region and interests. While a custom audience is a list of customers you gathered (uploaded or visitors or your site etc). You can create these audiences manually through the Ads Manager interface:

使用图形API资源管理器,可以按以下方式检索saved audiences:

Using Graph API Explorer, one can retrieve saved audiences as follow:

act_1234567890/saved_audiences

使用图形API资源管理器,可以按以下方式检索custom audiences:

Using Graph API Explorer, one can retrieve custom audiences as follow:

act_123456789/customaudiences

请注意,123456789不是我的真实帐号.我出于安全原因对其进行了更改.

Note that 123456789 is not my real account number. I changed it for security reasons.

因此,我可以同时检索custom audiencessaved audiences的ID,并且创建以custom audience为目标的广告效果很好,与以saved audience为目标的广告不同,该广告会给出上述错误消息.

So, I can retrieve IDs for both custom audiences and saved audiences and creating an ad targeting a custom audience works fine, unlike targeting a saved audience which gives the above error message.

一个麻烦的解决方法是保存 (每个本地saved audience),并在创建广告时使用该规范.这样做的问题是,某些targeting segments无效(Facebook决定随机中断某些细分市场),从而导致Facebook Ads API出现异常.另外,这意味着我经常需要保持saved audiences与我的本地副本同步.除非我当然要即时获取saved audiencetargeting并重新使用它,否则每次创建广告都会导致另一个API请求.

A cumbersome workaround could be to save the flexible_spec of each saved audience locally and use that spec when creating ads. The problem with that is that some targeting segments become invalid (Facebook decides to discontinue some segments at random times) which causes Facebook Ads API to hickup. Additionally, this means I constantly need to keep saved audiences in sync with my local copy. Unless of course I retrieve the targeting of a saved audience on the fly and re-use it, each time I create an ad resulting in yet another API request.

推荐答案

我自己弄清楚了.与custom audience不同,直接针对saved audience似乎是不可能的,这很奇怪.我要做的是首先从保存的受众群体中检索targeting,并在制作广告时重用该定位.

I figured it out myself. It seems impossible to directly target a saved audience unlike a custom audience, which is odd. What I did is retrieve the targeting from the saved audience first and reuse that targeting when creating the ad.

在这里,您可以看到官方文档的屏幕截图,其中仅显示custom audienceslookalike audiences可以作为目标.

Here you see a screenshot of the official documentation showing only custom audiences and lookalike audiences can be targeted.

saved audience检索targeting(使用Facebook PHP SDK):

Retrieving targeting from saved audience (with Facebook PHP SDK):

$api = Api::instance();

use FacebookAds\Http\Request;

$response = $api->call(
  "/987654321", 'GET',
  array('fields'=>'targeting')
);
$audience = $response->getContent();

以987654321作为已保存的受众ID.

然后将定位条件复制到广告(使用Facebook PHP SDK):

Then copy that targeting to the ad (with Facebook PHP SDK):

use FacebookAds\Object\Targeting;
use FacebookAds\Object\Fields\TargetingFields;

$targeting = new Targeting();
$targeting->setData($audience['targeting']);

此技术的缺点是saved audience更新时不会更新广告,并且需要额外的API调用,这会减慢广告的创建速度.

The disadvantage of this technique is that the ad won't be updated when the saved audience is updated and that it requires an extra API call which slows down the creation of the ad.

这篇关于Facebook Ads API错误:必须是有效的自定义受众ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆