如何使用Graph API获取照片Feed的Facebook Insights数据?

时间:2014-10-03 09:16:46

标签: facebook facebook-graph-api facebook-insights

Insights API适用于链接Feed,但不适用于照片Feed。对于照片Feed,即使Insights页面显示高覆盖率和参与率,Insights API也会返回0或为空。

以下是我的照片Feed的网址格式:

https://www.facebook.com/[PAGE]/photos/a.xxx.xxx.[PAGE ID] / [POST ID] /

Insights API返回:

{
    "id": "[PAGE ID]_[POST ID]/insights/post_story_adds_by_action_type_unique/lifetime", 
    "name": "post_story_adds_by_action_type_unique", 
    "period": "lifetime", 
    "values": [
        {
            "value": [
            ]
        }
    ], 
    "title": "Lifetime Talking About This (Post) by action type", 
    "description": "Lifetime: The number of unique people who created a story about your Page post by interacting with it. (Unique Users)"
}

1 个答案:

答案 0 :(得分:1)

我一直在讨论同样的问题......我可以告诉你的一件事是,你很可能在照片上使用了错误的身份证。

请确保您仅使用facebook api检索到的ID。所以这是一个示例流程:

1. Note your page-id
2. Use GRAPH to query <url-to-graph>/<page_id>/feed?access_token=<your_token>
3. From the response, take the photo-post-id you want to analyze
4. Use GRAPH to query <url-to-graph>/<id_from_step_3>/insights/?access_token=<your_token>
5. Check the metrics returned from step 4 and enjoy!

请注意,无法将page_id添加到任何post_id。因此,在FB api中写的{post-id}的每次替换都将是_。

希望有帮助...