Age, gender, & country not showing in Facebook Insights data - facebook

Nearly all the other metrics are available to view in Facebook Insights, except the user demographics. When I try to view them, I get an empty array:
"data": [
{
"name": "page_impressions_by_age_gender_unique",
"period": "day",
"values": [
{
"value": {
},
"end_time": "2015-10-08T07:00:00+0000"
}
],
"title": "Daily Reach Demographics",
"description": "Daily: Total Page Reach by age and gender.",
"id": "x/insights/page_impressions_by_age_gender_unique/day"
}
],
I have most permissions set: read_insights, manage_pages, publish_actions.

For me it's working for my page. If you don't have for daily means search in weekly or 28 days report. May be todays report not updated yet.
"Daily Reach Demographics" Also have "weekly and 28_days Reach Demographics" Search for that. And "read_insights" permission will be okay for this action.

Maybe it is related to one of these Facebook issues:
1993653884193030: page_impressions_by_age_gender_unique missing from page insights
1010193999087765: Some metrics are missing for period "day"
Response from Facebook:
This is actually not a bug, but by design. There are not enough impressions/data available to create a breakdown for that specific timeframe (in your case "day") so we do not return any data.

Related

Get empty Element List for post of my organization

I need to retrieve analytics of my companies posts.
I do have the following rights:
r_1st_connections_size
r_ads_reporting
r_basicprofile
r_emailaddress
r_liteprofile
r_organization_social
rw_ads
rw_organization_adminĀ  reporting data"
w_member_social
w_organization_social
for my Bearer token.
But my request:
https://api.linkedin.com/v2/shares?q=owners&owners=urn:li:organization:*myOrganisationId*
does return:
{
"paging": {
"start": 0,
"count": 10,
"links": [
{
"type": "application/json",
"rel": "next",
"href": "/v2/shares?count=10&owners=urn%3Ali%3Aorganization%<myOrganisationId>&q=owners&start=0"
}
],
"total": 568
},
"elements": []
}
What is strange. Because it genuinely succeeds, and even returns a total > 0 but the elements are ALWAYS for ALL pages empty.
How can that be? Any insights?
I would appreciate also any input on which endpoint provied most easily the most metrics like click-rate, impressions, ... , of the posts?
Thanks a lot for your help.
If you need to retrieve the insigths from a share object you need to use the adAnalyticsV2 endpoint (here).
You can than retrieve the data by querying the endpoint in this way:
https://api.linkedin.com/v2/adAnalyticsV2?q=analytics&pivot=SHARE&timeGranularity=DAILY&shares=List(urn:share:XXXX)
to get a list of all shares I use this (replace the 00000 with your company ID):
https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List(urn%3Ali%3Aorganization%3A00000)&sortBy=LAST_MODIFIED
That will actually give you a lot more, than you need but you will have a list of share urns as well as their texts and even authors. I wonder how are you planning to combine the two, cause that's what I am trying to figure out.
Thanks,
Piotrek

MS Graph REST API checkout user

I've managed to successfully checkout a file using the https://graph.microsoft.com/beta/drives/{driveId}/items/{itemId}/checkout
Now, I'd like to get the information about the user, who actually perform the checkout operation.
It's possible to check if the item is locked:
https://graph.microsoft.com/beta/drives/{driveId}/items/{itemId}?select=*,publication
However, according to DOCs, publication doesn't provide information about the checked user. Without information who locked the file is the whole checkin/checkout logic is useless.
This kind of information could be retrieved via the metadata for an item in a list as demonstrated below:
https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}/items/{item-id}?expand=fields(select=CheckoutUserLookupId)
Once you get checkout user id (CheckoutUserLookupId field) , user details could be determined via the following endpoint:
https://graph.microsoft.com/v1.0/sites/{site-id}/lists('User Information List')/items/{CheckoutUserLookupId}
where CheckoutUserLookupId is the user id from the previous request
https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}/items/{item-id} can't work with folders.
Anyway, drive endpoint "Allows access to the list as a drive" (according to MS Graph Docs). It works with folders as expected.
So I have
get the drive-id: /sites/${siteId}/drives
list root folder: /drives/{drive-id}/items/root/children?select=name,publication
if an item is locked, it's possible to list the activity on the item:
/drives/${idObj.driveId}/items/${idObj.fileId}?select=id&expand=activities
return list of actions:
"activities": [
{
"#odata.type": "#oneDrive.activityEntity",
"#odata.id": "https://xxxxxxxxxx/v2.0/oneDrive.activityEntity2a3649d6-2xxxxx",
"#odata.editLink": "oneDrive.activityEntity2a3649d6xxxxxx",
"#sharePoint.localizedRelativeTime": "0|July 30",
"action": {
"checkout": {}
},
"actor": {
"user": {
"email": "XXX#XXX",
"displayName": "vladimir",
"self": {},
"userPrincipalName": "XXX#XXX
}
},
"id": "XXXXXXXXXXXXXX",
"times": {
"recordedTime": "2018-07-31T04:59:03Z"
}
},
although no user ID at least a have the email....

Get user id and name from comment on Fan Page Wall

Since Facebook API update to v2.11, I cannot get User Id and Name from comments on FanPage Wall Post. Anyone can help/explain?
Usually I used this :
https://graph.facebook.com/[POST_ID_PAGE]/comments?order=reverse_chronological&access_token=[YOUR_ACCESS_TOKEN]
And the result just like :
{
"data": [
{
"created_time": values_date_TMZ,
"from": {
"name": USER_NAME,
"id": USER_ID
},
"message": THE_COMMENT,
"id": THE_COMMENT_ID
}
}
You need a Page Token now, to get user names - check out the changelog:
https://developers.facebook.com/docs/graph-api/changelog/version2.11#gapi
I assume you are using an App Token at the moment.
Edit: Of course it has to be a Page Token of the Page with the comment. And of course you need to manage the Page - else you would not even get a Page Token.

FQL query of photos for Facebook users with large numbers of photos

I need to get photos of an FB user sorted by likes.
I ran this FQL query via Facebook JavaScript SDK to get them:
SELECT object_id, src_big, src_big_width, src_big_height, link, like_info, caption, created
FROM photo
WHERE owner = MANY_PICS_USER_ID ORDER BY like_info DESC LIMIT 10
The query fails for users with more than 3000 photos. Turns out there are a lot of those users. Related Facebook bug is here http://developers.facebook.com/bugs/438568326189781
As a note: removing "ORDER BY like_info" makes query work, but there is no easy way for me to get those pictures, sorted by likes
To reproduce:
Pick a FB friend with at least 3000 photos, get their user Id, and run the above query (replacing MANY_PICS_USER_ID) in API GRAPH EXPLORER.
What is the best workaround? Or, can you suggest the easiest light-weight Open Graph solution?
To sort photos by likes you need the following:
Run the query which gives first 100 results (replace me with user id):
http://graph.facebook.com/me/photos?fields=id,source,likes&limit=100
Which return the following data structure:
"data": [
{
"id": "1234567890",
"source": "http://photo.url.in.facebook.cdn.com/",
"created_time": "2012-09-13T22:52:34+0000",
"likes": {
"data": [
{
"id": "1234567890",
"name": "Full Name"
},
.....
"paging": {
"next": "https://graph.facebook.com/1234567890/likes?limit=25&offset=25"
}
}
},
{
"id": "312323232323",
"source": "PICTURE_URL",
"created_time": "2012-09-12T20:54:27+0000",
"likes": {
"data": [..]
}
},
....
"paging": {
"previous": "http://PREVIOUS_URL?fields=id,source,name,height,width,link,likes&limit=100&since=123456",
"next": "http://NEXT_URL?fields=id,source,name,height,width,link,likes&limit=100&until=234567"
}
If total number of pictures is more than 100, run all next queries,
from the "next" link until the num of pics will be less then 100.
For every picture you need to count total number of likes. If the
number of likes is more than 25, run extra query from
likes.paging.next until number of likes will be < 25 and get the
total quantity.
Sort all those pics by number of likes.
So for the user with 3000 pics it will be in total 30 calls + extra calls for each picture with more than 25 likes.

facebook graph can not get comments

After Search post from graph
https://graph.facebook.com/search?q=watermelon&type=post&fields=from,message,picture,link,name,caption,comments,description,created_time,id&token=XXXXXXXXXXXXX
here will return some data. In the third post:
"from": {
"name": "Alessio Mrbillyplus Frustaci",
"id": "1665626783"
},
"picture": "http://external.ak.fbcdn.net/safe_image.php?d=AQDGoBK_lUeeMb5x&w=130&h=130&url=http\u00253A\u00252F\u00252Fi3.ytimg.com\u00252Fvi\u00252Fjo5GcYeh7XA\u00252Fdefault.jpg",
"link": "http://www.youtube.com/watch?v=jo5GcYeh7XA&feature=share",
"name": "Herbie Hancock \"Watermelon Man\"",
"caption": "www.youtube.com",
"description": "From the 1973 album \"Headhunters\" here's Herbie Hancock with \"Watermelon Man\" Sampled by Super Cat \" Dolly My Baby\" LL Cool J \"1-900-LL Cool J\" Shaquille O'N...",
"created_time": "2011-09-17T17:44:48+0000",
"id": "1665626783_235117223205324",
"comments": {
"data": [
{
"id": "1665626783_235117223205324_3043725",
"from": {
"name": "Alessio Mrbillyplus Frustaci",
"id": "1665626783"
},
"message": "La enne e la doppia effe aaaaaa",
"created_time": "2011-09-17T17:45:52+0000"
}
]
}
},
It is clearly that it has comments in it. So the PostID is 1665626783_235117223205324 and CommentID is 1665626783_235117223205324_3043725? But when I tried search a post or comments, the data return empty.
https://graph.facebook.com/1665626783_235117223205324?access_token=XXXXXXXXXXX//empty
https://graph.facebook.com/1665626783_235117223205324/comments?access_token=XXXXXXXXXXX//empty
https://api.facebook.com/method/fql.query?
callback=json&
query=SELECT%20comments%20FROM%20stream%20WHERE%20post_id%20%3D%20'1665626783_235117223205324'&access_token=XXXXXXXXXXXXXX //empty
What is the big problem?
There may be privacy settings in place which prevent the current user from seeing the posts or comments, where are those comments posted? Are you accessing them with an access_token from a user who can see the content?
As Mahima said, both of those calls should be working and i've tested equivalent calls with posts from my own news feed or page walls.
A call to /1665626783_235117223205324 for me returns false, which indicates i don't have permission to view the item.
This could also be a bug, but you'd need to have a very clear set of sample data to demonstrate the issue so it can be reproduced by Facebook
I tried with post id and comment id both as
http://graph.facebook.com/COMMENT_OR_POST_ID?access_token=APPLICATION_ACCESS_TOKEN
both are working ..
Make sure the access_token you are using is either of the application which you used for posting on a user's wal.. Or the access_token has sufficient read_stream and offline_access permission of the user ..