Search code examples
phpfacebook-graph-apifacebook-insightsmetric

How to get accurate data from "post_stories_by_action_type" facebook graph api insight


i am trying to get the count of the page post shares uisng graph api [how many times people shared this page post], based on facebook documentation the graph API request should be like this : page-id_post-id/insights/post_stories_by_action_type/lifetime

this is the returned output from graph api :

{
"id": "page-id_post-id/insights/post_stories_by_action_type/lifetime",
"name": "post_stories_by_action_type",
"period": "lifetime",
"values": [
{
"value": {
"like": 345,
"comment": 65,
"share": 27
}
}
],
"title": "Lifetime Post Stories by action type",
"description": "Lifetime: The number of stories created about your Page post, by action type. (Total Count)"
}

The problem is that, the returned number is not accurate, for example the shares count from the request is 27 but facebook shows people made 31 shares, also the other counts not accurate.

What should i do to get the accurate count of page post shares ?

Important notes :

1) in the documentation the data in "post_stories_by_action_type" are available in real time (facebook refresh the data each 15 minutes).

2) the post that returned this result is too old and people don't interact with it at the moment (so there is no new insights each 15 minutes).

Thanks in advance.


Solution

  • I am answering myself here in case anyone faced this problem, to get accurate shares count use this request : page-id_post-id?fields=shares

    P.S. this answer by "Shayne Xin Wang" from Facebook Developer Community.