Where is "on shares" data found in Facebook's api? - facebook

Clicking a post in Facebook's post insights shows a summary like this:
I am however bamboozled as to how a post can have 8 likes, 3 comments and 2 shares on shares of this post, without that post having been shared ('0 on post').
Trying to gain further insight into this:
/{post-id}/insights doesn't return any share information.
/{post-id}/sharedposts returns an empty set, even for posts that have been directly shared.
/{page-id}/posts just indicates the "shares on posts" (not on shares) and even omits that if it's zero like in this case.
Where can I find the "On Shares" figures in the api?

Maybe "on shares" is from people who liked the post because their friend liked it. and the original person hasn't liked the page. because the same issue happened with my account 2 Point Perspective and it didn't receive any "shares"!!

As far as I can conclude, "on shares" numbers can be calculated by total minus "on post" numbers. You can get total numbers from
/{page_id}_{post_id}/insights/post_stories_by_action_type
and "on post" numbers from
/{page_id}_{post_id}/?fields=likes.limit(0).summary(true),comments.limit(0).summary(true),shares
You should be able to get these numbers from /{page_id}_{post_id}/sharedposts/..., but as of this bug report, you won't be able to do so actually.
Also watch out for permissions and Graph API version number.

Had to think this through for awhile, but I finally got it (I think).
What it's basically saying is the following.
First line: you received a total of 8 Likes. The 8 Likes didn't come from your direct post. It came from the shares of other users (however many shares that was).
Second line: same situation as above. Except this time, you had 1 comment on your direct post, while 3 comments came from shares.
Third line: you get the gist.
Here is the exact language that describes how this works from Facebook.
"The metrics you see on a Page post when viewed from your Page's Timeline or in News Feed include likes, comments and shares that happened on the original post. The metrics in your Page Insights include likes, comments and shares from the original post plus any activity that happened if your post was shared. For example, if someone shares your post, and then their friend shares that post, this will be counted as 2 shares in Page Insights."
Source: https://www.facebook.com/help/336143376466063/

Related

Facebook Insights - Post Details

In the "Posts" section of Facebook Insights, you can click on your latest posts and get detailed information about them:
I'm trying to recreate this data in a web application, using the Facebook SDK for .NET. I have found most of these numbers through Facebook's Graph API, e.g:
.../v2.3/(page-id_post-id)/insights/post_impressions_unique/lifetime
.../v2.3/(page-id_post-id)/insights/post_stories_by_action_type/lifetime
.../v2.3/(page-id_post-id)/insights/post_consumptions_by_type/lifetime
.../v2.3/(page-id_post-id)/insights/post_negative_feedback_by_type/lifetime
...except the post content and the numbers marked in red. Using Fiddler, it looks like Facebook fetches these values from a URL outside the Graph API:
https://www.facebook.com/ajax/pages/insights/view_story/...
However, that URL is only accessible if you're logged in to Facebook. So, the question is:
Given an access token, can my (server-side) web application somehow get the post content, or at least the missing numbers? Preferably using the Facebook SDK, but any solution will do.
Update:
As #CBroe points out, simply querying the post id itself gives you enough info to recreate the post content:
.../v2.3/(post-id)?fields=name,message,picture,link
So, the last piece of the puzzle is to get the missing numbers. "Likes - On Post" can be found by querying the post's /likes with a summary:
.../v2.3/(page-id_post-id)/likes?limit=0&summary=true
..but "Comments - On Post" and "Shares - On Post" are trickier.
Querying .../v2.3/(page-id_post-id)/comments does give the number of comments on the post, but doesn't include answers to those comments, which are included in the number 5 in the picture above. You can recursively query /comments on each comment id, but that would generate too many queries to be worth it.
One might think that querying .../v2.3/(post-id)/sharedposts could give you the number of times a post has been shared, but it only gives you a few of the shared instances (due to other users' privacy settings?)
to clarify, you're trying to get the number of likes, comments, and shares.
Likes [post_id]/likes?summary=True&limit=0
NOTE: You can also call it when calling the post fields [post_id]?fields=id,likes.summary(true).limit(0)
Comments [post_id]/comments?summary=true&limit=0
NOTE: comments edge has a param filter https://developers.facebook.com/docs/graph-api/reference/v2.3/object/comments which may be why you see different numbers
NOTE: You can also call then when calling the post fields [post_id]?fields=id,comments.summary(true).limit(0)
Shares [post_id]?fields=shares
the sharedposts edge is empty b/c you don't have "read_stream" permission for the user's posts, https://developers.facebook.com/docs/graph-api/reference/v2.3/object/sharedposts#readperms
Edit (by OP):
Adjustments to get the same numbers that are presented in the "Post Details" popup:
Comments - On Post: (page-id_post-id)/comments?filter=stream&summary=true&limit=0
Using only post-id without prepending page-id gives the same result, but you also get a debug message saying "...actual number of results returned might be different depending on privacy settings."
Shares - On Post: (post-id)/sharedposts?fields=id
Don't prepend page-id here - that yields an empty result set.
Sadly, ?summary=true doesn't work, so I used the fields filter just to reduce the amount of data.
The suggested (post-id)?fields=shares gives a different number which seems similar to the insights numbers, but doesn't add up to any of them.

FB graph API problems with reading posts (type=status)

I'm trying to analize a large number of posts from varoius pages for my bachelor thesis. Therefore I'm using a tool called Facepager which uses the graph API to fetch data from Facebook.
I need the following data:
id, link, type, from and the count of likes, shares and comments (just the numbers, no further info!). In general, everything is working just fine, only posts classified type=status behave strangely. For some of these posts, there is no data shown about like, share and comment counts, further more there is no link given. But as mentioned before, this only happens sometimes! I searched for the affected posts manually on facebook and some of them had a large number of likes, shares or comments.
I also tried to fetch data with graph API explorer with similar results.
Is there any reason why it isn't possible to get share, like and comment count on some of the posts classified type=status?
Additionally, I'm planning to use the ID or if invalid, the link to open specific posts in my browser. This is not possible for some of the status posts either.
Sorry for that newbie question, it would be amazing if I could get an answer because at the moment I am quite desperate because this is really important for my bachelor thesis. Thanks a lot!
Because this kind of post is a post which "CAN NOT BE VIEWED".
ex: "xxxx likes a link", or "XXX commented on a post".
I suggest that you should filter out these posts by yourself.

Facebook post id returned using graph api and the posted Id on facebook are not same

I need to retrive the comments for the particular post on Facebook, so whenever i post sometext on facebook using graph api as mentioned below.
$result = $facebook->api($fid.'/feed/','post',$attachment);
It returns the post id in response($result).
When i login to facebook and hover on the "datetime" for that post, it shows me the different post id and not the returned one in my response, so i couldn't get the comments for that post id.
I use to get the comments using the code below.
$post_comments = $facebook->api('/'.$postid,array('access_token' =>'AAAAxxxxxx'));
Any Help would be Appreciated!
Thanks,
The Post ID returned by the API is in the form {user_id}_{post_id} so its slightly different than the one facebook shows. However, if you replace the _ with /posts/ you get the same URL as the one Facebook provides.
I ran into this behaviour myself some days ago – user used three different apps and thereby created three individual link-posts. The "x minutes ago"-link for each of them showed a different number of minutes, but clicking on any of them led to the same post, the first on that was made.
I suspect it has something to do with all three post being made from page tabs on the same fan page(?) – but i looks like a bug to me, because to any of his friends following the "x minutes ago"-link on one of the other two posts it surely must be a bit confusing to be taken to a different post detail page than the one the actually clicked on.

Facebook API definitions explained

I have the list of definitions for fields in the Facebook API.
http://developers.facebook.com/docs/reference/fql/insights/
The definitions are a brief and not explained. Is there a more detailed description of these somewhere? Specifically:
What is the difference between 'page_posts_impressions' and 'page_impressions'?
I see that the 2nd is larger than the 1st. What other kind of page impression would a user get that is not in their feed?
Also, how are organic and viral defined?
I thought that organic might be generated by the page's postings and viral might be generated by those posting stories about the page.
So I thought that organic + viral = total
I can see on some days this is true but not on others.
Thanks
John
From the page you linked:
page_posts_impressions - The number of impressions that came from all of your posts
page_impressions - The total number of impressions seen of any content associated with your Page
The second includes places users were exposed to your page other than via posts the page itself made, including a user's friends writing on the page wall, sharing a link to the page, etc

How can we get share count for posts on a page

I'm tyring to get the number of shares per post on a business page. I have read about the link_stats table which seems to have share_count for links. But I'm unable to find the share count per post. I can get number of comments and likes per post in the streams table. but share count seems to be missing. Please let me know if there is any other way to get share count per post in a page. thanks.
shares is provided as a connection on the /ID/feed endpoint, which means that you will be able to see the share count for posts in your /feed for your Page. This should really also be in the connections of an individual post, I suggest filing a feature request in the Facebook Bug Tracker for that.