In any social media campaign, there isn't anything more valuable than knowing who is your audience. Therefore, I've spent a few days putting together what is called the Facebook Friend Rank Algorithm.

It is a more-complete version of what I've already been using for many campaigns. It is written in PHP; the only dependency is Facebook SDK (v.3.1.1). If you are a developer, the Facebook Friend Rank Algorithm source code is available under the BSD license.

The common issue with building a friend-rank is that you need to ask for permissions that are otherwise redundant. ay-fb-friend-rank attempts to solve this issue by relying on whatever permissions are given. If you haven't done so yet, checkout the demo that is built to illustrate how friend-rank accuracy depends on the given permissions.

The exact mechanics behind the algorithm is described on the GitHub page. Overall, friend-index is built by checking what data is available, counting the number of interactions and assigning the appropriate weight to every action.

I use this information in campaigns where user is more likely to interact with a friend rather than a less known person, e.g. when the campaign requires to complete a task cooperating with a friend or the reward is shared.

There are many more permissions that can improve the friend-rank accuracy that the script doesn't utilise yet (2012 JUL 20), eg. user_hometown,friends_hometown,user_interests,friends_interests.