我正在使用 Facebook Marketing Api 创建广告和自定义受众。我怎么找不到将创建的自定义受众链接到 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";
我的要求是将自定义受众直接链接到 Adset,例如 AdSetFields::CUSTOMAUDIENCE => $audienceid
这至少可能吗?如果不能,我们如何将我们创建的自定义受众与 Adset 关联?