1
我試圖使用將用戶添加到自定義受衆下面的代碼如何將用戶添加到Facebook的定製觀衆
$audience = new CustomAudience($custom_audience_id);
$audience->addUsers(array(trim($mailAddress)), CustomAudienceTypes::EMAIL);
和
$users = array(
array('fname', 'lname', '[email protected]'),
array('fnamenew', 'lnamenew', '[email protected]'),
);
$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();
任何建議我該如何解決這個問題?
當您在創建空的自定義觀衆對象將二者結合起來的觀衆(從電子郵件和/你是否提到過這個'CustomAudienceFields :: DATA_SOURCE =>數組('EVENT_BASED'=>'WEB_PIXEL_HITS');'。如果沒有,那麼當你創建自定義的受衆時,你將需要添加這個數據源並嘗試你的代碼 – Haridarshan
這是什麼幫助我:https://stackoverflow.com/a/45555810/470749 – Ryan