Link 广告集的自定义受众

Link custom audience to an Adset

我正在使用 Facebook 营销 Api 来创建广告和自定义受众。我怎么找不到 link 为 Adset 创建的自定义受众群体的方法。 下面是 github 中可用的示例。目前我只能创建具有兴趣和地理位置的广告。

如下例所示,我们只能按兴趣和地理位置定位。

$results = TargetingSearch::search(
  $type = TargetingSearchTypes::INTEREST,
  $class = null,
  $query = 'facebook');
// we'll take the top result for now
$target = (count($results)) ? $results->current() : null;
echo "Using target: ".$target->name."\n";
$targeting = new TargetingSpecs();
$targeting->{TargetingSpecsFields::GEO_LOCATIONS}
  = array('countries' => array('GB'));
$targeting->{TargetingSpecsFields::INTERESTS} = array(
    array(
        'id' => $target->id,
        'name' => $target->name,
    ),
);


$adset = new AdSet(null, $account->id);
$adset->setData(array(
  AdSetFields::NAME => 'My First AdSet',
  AdSetFields::CAMPAIGN_ID => $campaign->id,
  AdSetFields::STATUS => AdSet::STATUS_ACTIVE,
  AdSetFields::DAILY_BUDGET => '150',
  AdSetFields::TARGETING => $targeting,
  AdSetFields::OPTIMIZATION_GOAL => OptimizationGoals::REACH,
  AdSetFields::BILLING_EVENT => BillingEvents::IMPRESSIONS,
  AdSetFields::BID_AMOUNT => 2,
  AdSetFields::START_TIME =>
    (new \DateTime("+1 week"))->format(\DateTime::ISO8601),
  AdSetFields::END_TIME =>
    (new \DateTime("+2 week"))->format(\DateTime::ISO8601),
));
$adset->validate()->create();
echo 'AdSet  ID: '. $adset->id . "\n";

我的要求是 link 自定义受众直接访问 Adset,例如 AdSetFields::CUSTOMAUDIENCE => $audienceid

这至少有可能吗?如果不能,我们如何将我们创建的自定义受众与 Adset 相关联?

您可以使用字段 custom_audiences,它接受一组要定位的自定义受众。我不确定名称是否真的也需要,但它在所有示例中:

$targeting->{TargetingSpecsFields::CUSTOM_AUDIENCES} = array(
  array(
    'id' => <AUDIENCE_ID>,
    'name' => <AUDIENCE_NAME>,
  ),
);

查看 targeting doc 并搜索 "Targeting Custom Audience & Partner Categories"