UPDATE March 28, 2013: Many people have commented here and emailed me that it no longer works for you. I have made an update to fix the bookmarklet for those with Facebook Graph Search. You can get the new bookmarklet here Updated Facebook Friends Ranking Bookmarklet to Work with Graph Search
UPDATE February 14, 2012: Many people have noted that Facebook has changed stuff in the last several months and so the bookmarklet broke. I have updated it to work on the new filename Facebook is using, and also to match the protocol you are browsing on. Drag this link to your bookmarks bar and click it when you are on Facebook. You may have to click it twice to work.
Have you ever wondered how Facebook orders your search results? Clearly they have some ordering about who they think you are looking for, and they seem to guess pretty well. I can only guess, but it seems like they order it based on who you interact with, whose profile you look at and who you have recently become friends with.
Well Facebook gives explicit numbers to the directed edges (connection going from you to your friend), about how much they think you are looking for this person. I wrote a bookmarklet that makes it easy to see this list. Although you already know who you look at most, it is eerie to see the list they have come up with—and the numbers they give. The more negative the number, the more Facebook thinks you are looking for them.
To try it out, just drag the image here up to your browser’s bookmark bar. Then go to Facebook and click the bookmarklet. More explanation below.
Note: This is really interesting, but may be embarrassing to you.
(Note: If you have https on, it won’t work. You can disable it temporarily by going to Account Settings/Security/Secure Browsing.)
How We Discovered this Link
We were working on our autocomplete search for the website we are building this summer called raunk.com and we were wondering why our autocomplete was so slow. If we typed fast, we could type faster than the results would show up. I thought, “Maybe I just type really fast, faster than the results can load.” We then checked Facebook. If we typed faster than Facebook autocomplete then it had to be okay. Well we started typing, and no matter how fast we typed, they already had results showing up.
How did they do this? Were their servers just that much faster than ours? (They are that much faster than ours.) But what turned out to be the difference was this file that they were preloading called first_degree.php. If you open up the Network panel in the Chrome Inspector or Firebug, you can see this file being requested asynchronously. Select XHR to only see AJAX requests.
Well in this file there is a lot of great information. It’s just JSON. There are probably two files, one which loads your first degree friends, and one which loads your “first degree” pages and events. Well if you open up the JSON file you will see, an ordered list of who Facebook thinks you are looking for.
Basically, you will find a list which is mostly who Facebook thinks you are Facebook stalking. And if you expand the entry you will see a field called ‘index’. ‘index’ is the number they give to that edge. The lower the number the earlier they show up on your search results.
And this stuff is all client-side, so it is all visible to you, and most likely will be for quite some time. This list is surprisingly interesting to check every now and then, and it will make you wonder how their algorithm is working and how those people go there.
Other Interesting Parts of this File
If you look a little more at this file you will find lots of other interesting information. There is an optional field that shows up in some results called ‘tokens’. This ‘tokens’ field stores common aliases to your friend’s name. For example, I have a friend named Michael, and his tokens says ‘mike’. My brothers is named Zach, but his tokens says ‘Brother’. Under Daniel it has ‘dan danny’. So look through the tokens, and find a friend who has a token that is not all close to his or her name. If you search it, you’ll notice that your friend will come up. That’s how it works. These are just common aliases for the name–not ones specific to your friend.
How the Bookmarlet Works
UPDATE: Thanks for all the comments and feedback! I really appreciate and am glad you found the bookmarklet interesting and entertaining. If you’d like to contact me about the bookmarklet or about our website raunk.com, just shoot me an email or find me on Twitter @jkeesh.