Get facebook share/engagement count - facebook

As a feature of our site, we are allowing users to share page(s) of our site on facebook by providing share button on our site.
We are adding users encrypted login id as part of the shared url in query param. say
www.somedomain.com/somepage.html?lid=user1
making the share url unique to each user who shares it.
where lid is the parameter namd and user1 is the encrypted loginid. we are also keeping the shared url/link in our system. So that later we can query to facebook using the url and get count of shares, likes and comments using facebook api.
https://graph.facebook.com/?id=www.somedomain.com/somepage.html?lid=user1&fields=og_object{engagement}
We are getting count of shares, comments and likes. But when a different user shares the same url, even though the url is different say
www.somedomain.com/somepage.html?lid=user2
And if I query to facebook api
https://graph.facebook.com/?id=www.somedomain.com/somepage.html?lid=user2&fields=og_object{engagement}
The count of shares, likes and comments of those two different urls (user1 and user2) are same.
If I comments on any one users share, and query on facebook api, the count increases on both apis ( for user1 and user2).
If I like on any one users share, and query on facebook api, the count increases on both apis ( for user1 and user2).
I think facebook ignores the query param lid=user1 & lid=user2 as part of id for any share link
and considers only the path as id i.e. www.somedomain.com/somepage.html? and counts are maintain against this id or path
My question is that:
Is it correct what I have explained above?
Is there any way to make same share link unique for different users? So I can get all types count of the share link of each users without conflicting each other users

Related

How to get number of like, share, comment of post of Facebook, Instagram and Twitter?

I am making ios and android apps and I want to get number of likes, shares, comments of any post that is posted by particular user from his/her Facebook, Instagram and Twitter accounts.
Means how can we get number of like, share, comment of the particular user's post of Facebook, Instagram and Twitter?
Does Facebook, Instagram and Twitter APIs/SDKs support this?
Please provide any reference link to achieve this.
I'm not sure about twitter or instagram API's but facebook graph API allows you to do this, given that you have the necessary permissions.
You can always check the public data, your own posts and such..if you want to have access to the data of a particular users feed/posts they will need to provide you with that permission. (user_posts in this case)
As for the total count you can retrieve it by adding .summary(1) to the end of your query ex. for likes, comments and shares.
me?fields=posts{comments.summary(1),likes.summary(1),shares}
you can also limit the number of comments/likes/shares to zero so that you retrieve only the total count per post. If that is what you want simply ad .limit(0) before the .summary(1) ex. comments.limit(0).summary(1)
Shares however are different from comments/likes/reactions, you can only retrieve the count of shares from graph API therefore you do not need to provide anything other than the "shares" query to the post to recieve that.
Cheers!

Facebook Graph API: Miscellaneous UserId

When exploring the Facebook Graph API, at: https://developers.facebook.com/tools/explorer The default example is get my name & id (under the assumption the browsers logged to my Facebook account). All good and I get my correct Id (facebook.com/id redirect to my profile).
So here is the thing: Exploring network traffic via developer console, I noticed some ajax have user id as url param, and the id is totally different from the previous one:
Same length
Much more zeros
So I tried same thing: facebook.com/new_id and same result: Redirect to my correct profile page.
How is that each user have 2 different id's?
It’s called app-scoped user ids, see https://developers.facebook.com/docs/apps/changelog#v2_0_graph_api

Facebook Graph API - See user which liked our page

I want to create an entrance app for some events at a congress.
Only users which liked our company-facebook page before should be allowed to enter.
I was reading around the last days, that it is not possible (only if the user logged in with facebook connect on our site) to see via the Graph API, which users liked our page? We would have the email adress (over an external registration form), but not the FacebookID.
I'm wondering if there are solutions outside, which i didn't found...
It's not possible to get the list of users who have liked your page.
But since you are having the email_ids of the users who have liked the page, you were left with one thing - searching users with email_id BUT unfortunately this has been disallowed by facebook. See here. It says-
The ability to pass in an e-mail address into the "user" search type was removed on July 10, 2013. This search type only returns results that match a user's name (including alternate name).
For future ref, if you have some application, you can query for /me and save their facebook ids.

Facebook: count number of unique users who shared a post

Is it possible to GET number of unique users who shared a post on a facebook fan page, remotely?
Basically I want to post a status update on my fan page. Next, for each time a fan shares the post, I want the count (of users who shared the post) to be updated on a separate web page. I know it's possible to get number of likes for a post, but how do I get the number of UNIQUE users who shared a post?
I believe you can do this with insights:
/PAGE_ID/insights?metric=page_storytellers_by_story_type
From what it looks like on my pages the user post value is the number of unique shares. The documentation isn't really clear on this though, so YMMV.

Get FB likes count for specific URL and page

This is a two questions in one.
Is it possible to get the likes count to a specific page inside a website? As in if there's a like button without a specific target url, likes will be given to the address in the window.location.href; can this number be retrieved without an API key?
Is it possible to get the official Facebook page/page id if I only have the URL of the website? If i only have the URL / domain name (coca-cola.com), can I get the facebook page which is https://www.facebook.com/cocacola?
You can check the like count of a website by calling the Graph like the following:
https://graph.facebook.com/?ids=http://www.your-website.com/the-url-or-so
To your Question if you can get a Facebook Page if you are the owner of the Business:
Yes! Some times ago I've read an article posted by Facebook where this is described. If you are the owner of a company/business/brand you can ask facebook for the page transfer to your account. For that you must be the owner and your business is really large. When the names of the companies are the same you must have to one which is more popular.
Is it possible to get the likes count to a specific page inside a website?
If that page is in the Open Graph, yes.
Is it possible to get the official Facebook page/page id if I only have the URL of the website?
No, because there is no such thing. No one is obligated to have a FB fan page for their business, organization or whatever.