1

我正在尝试使用营销 API(Facebook Ads SDK 2.5)为网络流量创建自定义受众。

这是我尝试过的。

$audience = new CustomAudience(null, 'act_'.$account_id);
$aud_data = array(
  CustomAudienceFields::NAME => $name,
  CustomAudienceFields::SUBTYPE => CustomAudienceSubtypes::CUSTOM,
  CustomAudienceFields::RULE => array('event' => array('i_contains' => 'ViewContent','i_contains' => $name ) ),
  CustomAudienceFields::PIXEL_ID => $pixelId,
  CustomAUdienceFields::DESCRIPTION => '',
  CustomAudienceFields::RETENTION_DAYS => 180,
  CustomAudienceFields::PREFILL => True
);

我收到了一条成功消息,我也可以在 Ads Manager 上看到受众。但是,问题是,当我尝试编辑这些观众时,我收到了这个错误。

Can't Edit Audience
This audience can't be edited because it was created using settings that are no longer available. You can still use this audience for your ads. To make changes or updates, create a new audience.

我究竟做错了什么?

4

1 回答 1

0

如果有人有同样的问题,这就是答案。

应该是 JSON 字符串而CustomAudienceFields::RULE不是数组(至少,这对我有用。)

所以,放在一起..

$audience = new CustomAudience(null, 'act_'.$account_id);
$aud_data = array(
  CustomAudienceFields::NAME => $name,
  CustomAudienceFields::SUBTYPE => CustomAudienceSubtypes::CUSTOM,
  CustomAudienceFields::RULE => '{"and": [{"event": {"i_contains": "ViewContent"}},{"content_name": {"i_contains": "'.$name.'"}}]}',
  CustomAudienceFields::PIXEL_ID => $pixelId,
  CustomAUdienceFields::DESCRIPTION => '',
  CustomAudienceFields::RETENTION_DAYS => 180,
  CustomAudienceFields::PREFILL => True
);

这应该有效。

于 2016-05-25T08:34:46.880 回答