创建自定义网站受众群体并预填过去的数据

时间:2014-11-06 14:25:42

标签: facebook facebook-php-sdk facebook-ads-api

我们希望根据网站像素数据创建自定义受众群体。这应该预先填写符合条件的过去访客

这是一个执行此操作的示例,但不预先填充

$set = new CustomAudience(null, $account_id);
$set->setData(array(
CustomAudienceFields::ID,
CustomAudienceFields::NAME =>"Test audience",
CustomAudienceFields::DESCRIPTION =>"Test audience from API",
  CustomAudienceFields::SUBTYPE =>'WEBSITE',
 CustomAudienceFields::RULE => '{ 
  "event": {
    "i_contains": "ViewEvent" 
  }
}',
CustomAudienceFields::RETENTION_DAYS =>90


));

$set->create();

需要通过哪些来触发prefil?文档为curl调用指定了一个'prefil'参数,但我看不到PHP SDK中的相关字段?

1 个答案:

答案 0 :(得分:0)

直到昨晚我们修补添加此功能时才从SDK中删除。

您现在可以添加参数:CustomAudienceFields::PREFILL => true,一切都应该有效!

$set->setData(array(
  CustomAudienceFields::ID,
  CustomAudienceFields::NAME =>"Test audience",
  CustomAudienceFields::DESCRIPTION =>"Test audience from API",
  CustomAudienceFields::SUBTYPE =>'WEBSITE',
  CustomAudienceFields::RULE => '{ 
    "event": {
      "i_contains": "ViewEvent" 
     }
  }',
  CustomAudienceFields::RETENTION_DAYS =>90,
  CustomAudienceFields::PREFILL => true,
));