我正在使用Facebook自动生成的代码来尝试连接到营销API以获取广告系列统计信息。这样,我得到:
未捕获的FacebookAds \ Http \ Exception \ AuthorizationException:(#100)结果,操作:喜欢,video_play_actions:video_view,video_avg_time_watched_actions:video_view,unique_actions:link_click对于字段参数无效。
$fields = array(
'results',
'reach',
'actions:like',
'video_play_actions:video_view',
'video_avg_time_watched_actions:video_view',
'unique_actions:link_click',
);
var_dump($fields);
$params = array(
'level' => 'campaign',
'filtering' => array(array('field' => 'campaign.delivery_info','operator' => 'IN','value' => array('active'))),
'breakdowns' => array(),
'time_range' => array('since' => '2017-05-19','until' => '2019-05-19'),
);
echo json_encode((new AdAccount($ad_account_id))->getInsights(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);
以上,我根据this answer使用了campaign.delivery_info。我也尝试过(根据自动生成的代码):
'filtering' => array(array('field' => 'delivery_info','operator' => 'IN','value' => array('active')))
答案 0 :(得分:1)
似乎您要输入旧值字段,请尝试以下操作:
$fields = array(
'reach',
'actions',
'video_play_actions',
'video_avg_time_watched_actions',
'outbound_clicks',
);
希望获得帮助
NB:results
字段不可用