Is there a way to retrieve the reach from my App posts?
Example:
My app posts photos on a specific fan page, I would like to retrieve the reach that my app provided to that fanpage in order to show them how awesome my app is.
Using the page access token for the page you manage, (with read_insights Permission).
You can then access /POST_ID/insights to retrieve insights information about that post.
For a sample post on my page, this returns the impressions data for the post.
Excerpt:
{
"id": "[ID REMOVED]/insights/post_story_adds_by_action_type/lifetime",
"name": "post_story_adds_by_action_type",
"period": "lifetime",
"values": [
{
"value": {
"like": 20,
"comment": 3,
"share": 1
}
}
],
"title": "Lifetime Post Stories by action type",
"description": "Lifetime The number of stories created about your Page post, by action type. (Total Count)"
},
{
"id": "[ID REMOVED]/insights/post_impressions_unique/lifetime",
"name": "post_impressions_unique",
"period": "lifetime",
"values": [
{
"value": 936
}
],
"title": "Lifetime Post Total Reach",
"description": "Lifetime The number of people who saw your Page post. (Unique Users)"
},
{
"id": "[ID REMOVED]/insights/post_impressions/lifetime",
"name": "post_impressions",
"period": "lifetime",
"values": [
{
"value": 2936
}
],
"title": "Lifetime Post Total Impressions",
"description": "Lifetime The number of impressions of your Page post. (Total Count)"
},
The blog post from when this was launched is here: https://developers.facebook.com/blog/post/573/
And the insights connection is mentioned in the Post documentation
Related
I am trying to get facebook page insights using Facebook Graph API, I see some strange numbers in page_cta_clicks_logged_in_total(looks like they are coming in all logged_in metrics)
Following is a sample Insight data from Facebook
{
"name": "page_cta_clicks_logged_in_total",
"period": "day",
"values": [
{
"value": {
"470946356598165": 0,
"156880401338097": 0
},
"end_time": "2017-12-13T08:00:00+0000"
},
{
"value": {
"470946356598165": 0,
"156880401338097": 2
},
"end_time": "2017-12-14T08:00:00+0000"
}
],
"title": "Daily Total CTA click count per Page",
"description": "Daily: Total CTA click count per Page",
"id": "<page_id>/insights/page_cta_clicks_logged_in_total/day"
}
what are the numbers 470946356598165 & 156880401338097
You get these ids with click related metrics (Ex. page_cta_clicks_by_age_gender_logged_in_unique, page_cta_clicks_logged_in_total, page_cta_clicks_logged_in_unique).
These ids are basically ids of the Page Buttons (look at the following image).
You can get the details of the button by doing following API call
https://graph.facebook.com/470946356598165?access_token=[access_token]
i see the following response
{
"id": "470946356598165",
"type": "MESSAGE",
"status": "ACTIVE"
}
You can check the node type of the id, through facebook graph api:
https://graph.facebook.com/470946356598165?metadata=1
https://graph.facebook.com/156880401338097?metadata=1
// response:
{
"id": "470946356598165",
...
"metadata": {
"fields": [
...
],
"type": "pagecalltoaction"
},
}
It gives us hints that the node type is pagecalltoaction, which is Page Call To Action.
See More: How can I know if a node returned from Facebook Graph API is a profile or a page?
I'm trying to figure out which (if any) API will allow me to access Video View Count (views for a given facebook video). I've looked through the documentation for Atlas, Graph, and Marketing API but I can't seem to find any API call that would return this metric.
Was this stripped from the APIs after the issues surrounding the authenticity of the metrics arose a few months back?
Simply do an insights request for the post that includes the video. There are many metrics, all documented here.
You'll also need enough permissions to the page; you cannot look at someone else's posts' insights (therefore the example below will return empty data).
For example 127615610597242_1608135349211920/insights/post_video_views
Example output:
{
"data": [
{
"name": "post_video_views",
"period": "day",
"values": [
{
"value": 1111,
"end_time": "2016-11-24T08:00:00+0000"
},
{
"value": 2222,
"end_time": "2016-11-25T08:00:00+0000"
},
{
"value": 3333,
"end_time": "2016-11-26T08:00:00+0000"
}
],
"title": "Daily Total Video Views",
"description": "Daily: Total number of times your video was viewed for more than 3 seconds. (Total Count)",
"id": "127615610597242_1608135349211920/insights/post_video_views/day"
},
{
"name": "post_video_views",
"period": "lifetime",
"values": [
{
"value": 44444
}
],
"title": "Lifetime Total Video Views",
"description": "Lifetime: Total number of times your video was viewed for more than 3 seconds. (Total Count)",
"id": "127615610597242_1608135349211920/insights/post_video_views/lifetime"
}
]
}
For example this graph
https://graph.facebook.com/audi/posts?access_token=[ACCESS TOKEN]&fields=id,message,picture,link,name,description,type,icon,created_time,from,object_id&since=2016-10-14T17:54:17+0000&limit=1
will give you this result(after replace ACCESS TOKEN with your access token ) :
{
"data": [
{
"id": "96585976469_10153772437221470",
"message": "Take a night tour of Capitol Hill with the #AudiRS7. #AudiDuel",
"picture": "https://scontent.xx.fbcdn.net/v/t1.0-0/s130x130/14680669_10153772435521470_6025374941796908984_n.jpg?oh=3654e74f79914c9bb0fa596ce8434c46&oe=589E82B4",
"link": "https://www.facebook.com/audi/photos/a.101113351469.101662.96585976469/10153772435521470/?type=3",
"name": "Photos from Audi USA's post",
"type": "photo",
"icon": "https://www.facebook.com/images/icons/photo.gif",
"created_time": "2016-10-14T17:54:17+0000",
"from": {
"name": "Audi USA",
"id": "96585976469"
},
"object_id": "10153772435521470"
}
],
"paging": {
"previous": "https://graph.facebook.com/v2.5/96585976469/posts?fields=id,message,picture,link,name,description,type,icon,created_time,from,object_id&limit=1&since=1476467657&access_token=[ACCESS TOKEN]&__paging_token=[ACCESS TOKEN]&__previous=1",
"next": "https://graph.facebook.com/v2.5/96585976469/posts?fields=id,message,picture,link,name,description,type,icon,created_time,from,object_id&limit=1&since=2016-10-14T17\u00253A54\u00253A17+0000&access_token=[ACCESS TOKEN]&until=1476467657&__paging_token=[ACCESS TOKEN]"
}
}
and this is the link of the post
https://www.facebook.com/audi/posts/10153772437221470
it gave me just the first one photo but I need all photos in this post
attachments is the field you are looking for.
(Seems not officially documented, perhaps because those aggregate posts are special. But Graph API Explorer suggests it as one of the available fields.)
I want to create app for get users' interaction with page. Each users like, comments, share specific page post.
I want to get count of total likes, comments and shares done by each user.
I used Graph API to return page
https://graph.facebook.com/PAGE_ID/feed?fields=id,likes,comments{from},shares
i got results similar to this.
{
"data": [
{
"id": "478412518924513_633895136709583",
"likes": {
"data": [
{
"id": "3696534343199936",
"name": "User Name"
},
{
"id": "576343349495810279",
"name": "User name"
}
],
},
"comments": {
"data": [
{
"from": {
"id": "154e3485900543",
"name": "user name"
},
"id": "633895096709587_633907896708307"
},
{
"from": {
"id": "10202701931494709",
"name": "User anme"
},
"id": "633895096709587_633899590042471"
}
],
}
},
How can i get how many likes,comments made by each user?
There are no endpoints you can get these counts from. This means that you have to aggregate the data yourself, namely
1) Iterating over the Page's Feed:
GET /{Page_ID}/feed?fields=id,created_time,likes{id},comments{from{id}},sharedposts&limit=200
and use the paging info to get the next results
See
https://developers.facebook.com/docs/graph-api/reference/v2.1/page/feed/#read
https://developers.facebook.com/docs/graph-api/reference/v2.1/post#edges
2) Aggregate the resulting data yourself in your application
I am fetching the Facebook news feeds through API. User can comment on a post from website. but some posts doesnot allow the comment like Like Stories, add friend stories, change profile pic stories etc
How I can check that if the post allow the comment or not
The actions property of the post when you retrieve it from the API will show if the current (whose access_token you're using) user can like or comment on the post, e.g.
/20531316728_167191526758558
Contains:
{
"id": "20531316728_167191526758558",
"from": {
"name": "Facebook",
"category": "Product/service",
"id": "20531316728"
},
"message": "Find your polling place on Facebook at http://bit.ly/Fbppl and then watch the nation vote in real time.",
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQCD6BNbTzxhmwEq&w=90&h=90&url=https%3A%2F%2Fs3.amazonaws.com%2FFacebookHackers-production%2Fissue4_data%2Fissue4_fb_og.png",
"link": "http://www.facebookstories.com/vote",
"name": "America Votes 2012",
"caption": "www.facebookstories.com",
"description": "Watch the nation vote in real time.",
"icon": "https://s-static.ak.facebook.com/rsrc.php/v2/yN/x/aS8ecmYRys0.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/20531316728/posts/167191526758558"
},
{
"name": "Like",
"link": "https://www.facebook.com/20531316728/posts/167191526758558"
}
],
// (and more properties which aren't relevant