15

Using the Facebook Graph API or some other means, is there a currently-available way to get a user's follower count? You'd think it would be a simple readable metric field at the user level, but after hours of searching, I cannot find such a field.

I know Facebook considers the concept of followers to be valid, because they have a working "edge" for it with their web interface, https://www.facebook.com/user_name/followers as well as listing the account on the user's main page (see image example below).

Certainly it seems the capability to read, or at least derive, the followers count existed previously in the form of reading the "subscribers" list for a user, but that's now obsolete. An alternative method seems to have been to use FQL to query the data. This method is now also obsolete. And there are stackoverflow questions about it, a good example is here, but they seem to relate to previous capabilities no longer available.

Example from Facebook user page

6 Answers 6

10

According to the docs, there is no possibility to get the follower count: https://developers.facebook.com/docs/graph-api/reference/user

The subscribers endpoint was removed with v2.0 already: https://developers.facebook.com/docs/apps/changelog#v2_0

Other threads about the same topic:

3
  • I agree about the endpoint. I've looked several times at the API reference page you link to, but I don't see it explicitly stated that there's "no possibility" as you say. Not that I doubt you, but if it's not too much trouble, could you quote me specifically where it says that? Commented Jun 1, 2016 at 20:44
  • if something is not even in the user table, you can be pretty sure it does not exist ;) - this has been discussed some times already though, i have added the first links i could find in my answer.
    – andyrandy
    Commented Jun 1, 2016 at 21:42
  • 1
    why the downvote? please add a comment so i can improve my answer if needed.
    – andyrandy
    Commented Dec 19, 2017 at 12:04
2

If you have an access_token, you can call {profile-id}/insights/page_fans_country and retrieve the number of people who like the page aggregated by country. This works for any public profile.

https://graph.facebook.com/{profile-id}/insights/page_fans_country?access_token={access-token}

You could then sum up the countries to get the total number of followers. If you need to retrieve followers for your own profile, you can call page_fans which provides the total number of people who have liked your page.

3
  • Sum up the values from one of the arrays containing 45 countries. As close as you can get it seems since page_fans returns nothing. Commented Apr 5, 2017 at 23:26
  • insights/page_fans actually returns valid results for me on a new integration using the php sdk
    – ShaneMit
    Commented Aug 28, 2017 at 17:26
  • This doesn't work for Users. Error: (#100) Tried accessing nonexisting field (insights) on node type (User)
    – Westy92
    Commented Aug 26, 2021 at 15:05
2

You can use fan_count:

{
  "id": "235014179868339",
  "name": "Zoella",
  "fan_count": 2647287
}

Facebook Graph API Explorer

3
  • 2
    This only works for facebook pages not individual profiles.
    – Learner
    Commented Sep 16, 2017 at 1:41
  • Warning on fan_count for Page objects: I just a few days figuring out it returns the number of people who like the page. Not the number who follow it. I don't know if it's the same for User objects. Watch out in case it's the same. Commented Nov 9, 2017 at 21:59
  • 2
    fan_count description from the Page object's metadata: "The number of users who like the Page. For Global Pages this is the count for all Pages across the brand". fan_count is not a followers count. Commented May 30, 2018 at 13:37
1

This is an updated and working code snippet which can be used to retrieve Facebook like count of a specific page. To use this code snippet you’ll need a Facebook App ID and Secret Key. This use latest 2.8 API version method.

enter image description here

Step 1:

Go to https://developers.facebook.com/ login with your facebook account. If you don’t have one you have to create one.

Step 2:

Created an app from facebook developer.

Step3:

You have to get App ID and App Secret from app you created.

enter image description here

Step 4:

PHP Code to get facebook like count of a page.

<?php
function fbLikeCount($id,$appid,$appsecret){
  $json_url ='https://graph.facebook.com/'.$id.'?access_token='.$appid.'|'.$appsecret.'&fields=fan_count';
  $json = file_get_contents($json_url);
  $json_output = json_decode($json);
  //Extract the likes count from the JSON object
  if($json_output->fan_count){
    return $fan_count = $json_output->fan_count;
  }else{
    return 0;
  }
}
echo fbLikeCount('coregenie','___APPID___','___APPSECRET___');
?>

Please edit your page name , app id, app secret.

This method is working. Tested on 19/12/2017

2
  • just a guess, because it happened in the same time: did you downvote my answer? because it is 100% correct, the question was if there is a way to get the followers of a user profile and that is definitely not possible. what you describe in length is about LIKES, not FOLLOWERS.
    – andyrandy
    Commented Dec 19, 2017 at 12:06
  • 1
    fan_count was added in v2.6 and according to the docs, it returns the total likes. developers.facebook.com/docs/graph-api/reference/page
    – AdonisN
    Commented Jan 3, 2018 at 18:38
1

What I did to see if these metrics exist in the api was to check the requests made by Facebook when creating a report, I got the following metrics:

metric=page_daily_follows,page_daily_follows_unique,page_daily_unfollows,page_daily_unfollows_unique,page_follows

It should be clarified that these are not in the documentation, I hope it helps.

0

You can use metric page_follows to get the follower count, I used it and it was correctly.

1
  • Your answer could be improved by providing an example of the solution and how it helps the OP.
    – Tyler2P
    Commented Jun 13, 2023 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.