gpt4 book ai didi

php - 如何将用户添加到 Facebook 自定义受众

转载 作者:行者123 更新时间:2023-12-05 07:46:40 27 4
gpt4 key购买 nike

我正在尝试使用以下代码将用户添加到自定义受众

$audience = new CustomAudience($custom_audience_id);
$audience->addUsers(array(trim($mailAddress)), CustomAudienceTypes::EMAIL);

$users = array(
array('fname', 'lname', 'someone@example.com'),
array('fnamenew', 'lnamenew', 'someone_new@example.com'),
);

$schema = array(
CustomAudienceMultikeySchemaFields::FIRST_NAME,
CustomAudienceMultikeySchemaFields::LAST_NAME,
CustomAudienceMultikeySchemaFields::EMAIL,
);

$audience = new CustomAudienceMultiKey(<CUSTOM_AUDIENCE_ID>);

$audience->addUsers($users, $schema);

但是我在两个代码中都遇到了错误

(#2650) Failed to update the custom audience: This audience was created from data source EVENT_BASED.WEB_PIXEL_HITS, which does not support data source FILE_IMPORTED.HASHES_OR_USER_IDS

下面是我用来创建自定义受众的代码。

$audience = new CustomAudience(null, $accountId);
$audience->setData(array(
CustomAudienceFields::NAME => $associative_arr['name'],
CustomAudienceFields::PIXEL_ID => $associative_arr['pixelId'],
CustomAudienceFields::DESCRIPTION => $associative_arr['description'],
CustomAudienceFields::RETENTION_DAYS => $associative_arr['retensionDays'],
CustomAudienceFields::SUBTYPE => CustomAudienceSubtypes::WEBSITE,
CustomAudienceFields::RULE => array('url' => array('i_contains' => $associative_arr['websiteUrl'])),
CustomAudienceFields::PREFILL => $associative_arr['prefill'],
CustomAudienceFields::DATA_SOURCE => array('EVENT_BASED' => 'WEB_PIXEL_HITS')
));
$audience->create();

有什么建议可以解决这个问题吗?

最佳答案

您只能将用户添加到通过电子邮件创建的自定义受众,而您在创建受众时显示的代码是基于您网站上的用户事件。您可以按照此文档通过电子邮件创建自定义受众: https://developers.facebook.com/docs/marketing-api/audiences-api#build

然后在您的广告中,您可以结合这两种受众(来自电子邮件和/来自

关于php - 如何将用户添加到 Facebook 自定义受众,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40483537/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com