Who does Facebook think you are searching for?

I found this article mentioned on Mashable. This information and process will allow you to see who Facebook thinks has the closest connections to you. This shows your historic activity with people on Facebook over time and orders all your friends by the amount that you stalk them. This data could also be effected by how often they stalk you as well. I would like to preserve this information so that everyone can learn the behind the scenes Facebook tracking that goes on. I pulled the Google cache version to get the article below. Also included are backup copies of the Javascript that is requesting information from Facebook’s first_degree.php file.

If you are coder / programmer and can make the data file you get from Facebook display a more user friendly view of their friends and First Degree Index rankings let me know! I’ll be messing with it the next few days to get it working as well. If this is properly working you’ll be able to see which friend’s Facebook is putting prominence to in your Facebook News Feed, associated rankings, values and tokens they have attached to them. This is a complete reverse engineering of Facebook’s feed algorithm. Very interesting stuff! :)

Latest UPDATE (easiest way to get this data):

First you need to get your Facebook Numeric ID. You can do that by visiting link #1 below. You’ll need your vanity name for Facebook. The next thing you’ll do is use link #2 to enter in your ID # into the URL to pull your entire First Degree relationships in order. There is a possibility that the output will give you an error because your Facebook is being accessed with HTTPS, if you see https://www.facebook.com then you’ll need to change your Secure Settings in Facebook. To do this go to this link and disable secure browsing: https://www.facebook.com/settings?tab=security

1. Get your Facebook Member ID # HERE
2. Get your Facebook First Degrees Data file HERE

Once you have your Facebook Data file you will have a lot of strings of data, the order of the people are the people that Facebook thinks you stalk the most. Each person is given an Index Ranking Number. Typically you have a very strong connection and stalk people that are in the NEGATIVE index numbering. For instance a -14.5230519 would be an incredibly high stalking rating. My high ones start at -1 and go from there. The higher the positive number the less of a First Degree’s connection that person and you have.

If you look beside people’s names they’ll have a field called tokens. If you take any of these words and put them in Facebook search it will bring up their Facebook profile.

My next task is to find something that will clean up this data for your easily and make it more readable in a pretty way. :)

Below is the original article & comments:

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.

Facebook Friends

Try dragging this link if the image doesn’t work for you.
Facebook Friends

Tested on Chrome, Firefox, and Safari. If bookmarklet does not work on chrome, just try creating a new bookmark with the javascript as the url.

(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.

First Degree Example

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

Here is how the bookmarklet works: It creates a script element on the page, gets a javascript file from my blog, and this file makes a request to the file first_degree.php with the correct parameters, and then it displays the results formatted nicely on your page.

This entry was posted in Computer ScienceInternet and tagged  by Jeremy Keeshin. Bookmark the permalink.


  1. Really neat, thanks for diving in and explaining this so well.

  2. Wow very nice work…embarrassed to see that i am stalking my old college friend for such a long time any ways nice work

  3. Hi,
    I’d like to interview you for PCWorld. WOuld you like to answer some basic questions on the information stated in this article?

  4. very impressive! i love how it works!

  5. I’m not certain, but in my list, it looks like some of the ranked names are friends of my friends who were looking at my page, as opposed to me looking at them.

  6. FYI


  7. well it only worked once, can’t get it to work again, what do the numbers on the right side mean?

  8. Mauro Balbino on August 18, 2011 at 5:48 am said:

    Well done, guys! Wonderful job!!

  9. Oliver on August 18, 2011 at 5:51 am said:

    Nice find! If you can work out how they come up with these numbers, that would be amazing.

    Things that seem very likely to me:
    - The list is based on quite recent interactions
    - It seems to matter a lot more if you visit someone’s profile than if you just reply to something on your newsfeed
    - Facebook doesn’t care if you’ve blocked someone from your newsfeed (in fact, this seems to help: Andy isn’t on my newsfeed because he spams like crazy, I go to his profile once in a while to see what he’s been up to, Facebook see that I like going to his profile)

    What I’d like to know:
    - Does mucking around with photos etc matter?
    - Does the ‘friendship’ page matter?
    - Does my rating of someone effect their rating of me?

  10. Did not work, I have https enabled by default, so Chromium blocked the insecure request. Enabling the loading of insecure content I still got errors:

    XMLHttpRequest cannot loadhttp://www.facebook.com/ajax/typeahead/search/first_degree.php?__a=1&filter0=user&lazy=0&viewer=number_censored&token=v7&stale_ok=0. Origin https://www.facebook.com is not allowed by Access-Control-Allow-Origin.
    edges.js:39Uncaught TypeError: Cannot read property ‘payload’ of null

    • That’s cause if you have https turned on, facebook with block the http-request. The request for the first_degree.php is done over http, and is thus blocked by facebook.

  11. Pingback: Here’s How To Reveal a Secret Facebook List of People You’ve Been Stalking | TechKawn
  12. Pingback: Here’s How To Reveal a Secret Facebook List of People You’ve Been Stalking
  13. This is very embarrassing.

  14. Jeroen on August 18, 2011 at 6:13 am said:

    Awesome, nicely done!

  15. Didn’t work on chrome

  16. Pingback: Browser Extension Reveals The People You’re Most Active With On Facebook | TechCrunch
  17. Pingback: Blog ALL » Bookmarklet Reveals The People You’re Most Active With On Facebook
  18. Pingback: Bookmarklet Reveals The People You’re Most Active With On Facebook | Droid Universe
  19. Brilliant! How about the other way round, who are looking at our profile, like many spams use the trick to spread their virus…??

    • yourprofileon August 18, 2011 at 10:56 pm said:

      I have no proof, but I thought that others have said (maybe even FB) in stories about those scams, that that info is not kept, or at least not available at the browser end at all.

  20. Error on Chrome 13 on Win XP:

    Uncaught ReferenceError: Env is not defined
    (anonymous function)

    line 22 of edges.js

  21. Pingback: Bookmarklet Reveals The People You’re Most Active With On Facebook | Redwood Falls News
  22. Nice Bookmarklet. But you should mention that it works only if you switch secure browsing (https) off at your facebook account security-page.

  23. Pingback: Bookmarklet Reveals The People You’re Most Active With On Facebook | XSDirect
  24. Pingback: Bookmarklet Reveals The People You’re Most Active With On Facebook | Farmington News | Farmington Local News
  25. Sidrah Zaheer on August 18, 2011 at 7:26 am said:


    Thanks for discovering this Facebook stalking measurement tool. I wonder if it will stay there.

    And you, despite being referred to on Mashable, have no comment here. Will you be deleting me too?

  26. cool stuff. great post.

  27. Freakin brilliant. Nice hack. Not sure if I agree with results 100%, but there’s certainly some degree of accuracy.

  28. hahaha.. It shows my own name in negative and all others as positive. Wonder that that implies eh :-/

  29. Pingback: Bookmarklet Reveals The People You’re Most Active With On Facebook | Delano News | Delano Local News
  30. looking at ex girlfriend isn’t the best thing? :)

  31. Would it be possible to get this data for users through their API (for use in app development?)

    Or is it already possible and I’m missing something?


  32. Pingback: Bookmarklet Reveals The People You’re Most Active With On Facebook | Orono News
  33. Pingback: Bookmarklet Reveals The People You’re Most Active With On Facebook | Blogburger
  34. Simply put – you’re awesome! Thanks for sharing this.

  35. Pingback: Here’s How To Reveal a Secret Facebook List of People You’ve Been Stalking (Mashable) | News Bulletins
  36. Didn’t work for
    Safari 5.1 (6534.50)
    Opera 11.01
    Firefox 4.01

    Worked for
    Chrome 13.0.782.112

    All on Mac OSX 10.6.8

    And thanx, interesting info

  37. Pingback: Come scoprire quali sono gli amici di Facebook di cui leggiamo più spesso i post e i commenti. | Guadagnare con Adsense
  38. seesky on August 18, 2011 at 9:49 am said:

    Excellent ! merci

  39. Pingback: Bookmarklet Reveals The People You’re Most Active With On Facebook | Ebay shopping tips
  40. Pingback: Here’s How To Reveal a Secret Facebook List of People You’ve Been Stalking (Mashable) | Stock Market News – Business & Tech News
  41. totally cool. why would it be embarrassing though?

  42. curious on August 18, 2011 at 11:21 am said:

    oh god is there a way to delete this?!

  43. You are GOOD. Thanks for sharing

  44. Pingback: Bookmarklet Reveals The People You’re Most Active With On Facebook | BEERtainment.tv
  45. Pulque on August 18, 2011 at 12:13 pm said:

    It seems to be very heavily weight towards recent as well as recurrent look-ups; people who sprung up on my newsfeed this morning whose profiles I checked out for the first time in years are in the top ten.

  46. I have 2 duplicate (it looks like) lists. Problem is, a lot of these people are not even on my friends list nor have I ever looked at their profiles nor do I even know who they are. It must be 2 sided. People who are also looking at my profile. Just an FYI

  47. Henry M on August 18, 2011 at 12:34 pm said:

    It appears the list also shows who has looked at you, as people i have never looked at appear on my list!!

    • I agree, it seems to somehow blend some of my recent lookups with searches by complete strangers I never “touched” on FB.

  48. Sander on August 18, 2011 at 12:37 pm said:

    Nice job. Doesn’t work when secure browsing is enabled in Facebook though.

  49. Pingback: ??? ??? ???? ?? ????? ?????? ???? ???????? | ????? ????
  50. You could make this work in https on by changing the requested url on runtime. Instead of doing $.ajax({url: “http://www.facebook.com/ajax/typeahead/search/first_degree.php”}), you could use window.location.protocol in place of the “http:”, so just call $.ajax({url: window.location.protocol+”//www.facebook.com/ajax/typeahead/search/first_degree.php”})

  51. Pingback: Facebook tells you who your closest friends are, why Google might keep MMI’s handset business, and Trial by Combat online
  52. Interesting to see that the list contains both people that are not my Facebook friends (and that I haven’t searched for etc).

    Recency gives high ratings as a friend I connected with only yesterday is high in the list although that is my only interaction with her (haven’t seen a status or even looked at her profile yet).

    Nice work!

  53. This has to be 2-sided. People I never heard of and never visited their profile are showing up in my list. A little more investigation shows them as friends of friends or in some cases co-workers.

  54. Pingback: Pogledajte s kim imate najviše interakcije na Facebooku | Zimo | follow & share
  55. Pingback: Who Have You Been Stalking the Most on Facebook?
  56. John Martinez on August 18, 2011 at 2:37 pm said:

    NICE! Of course, I have very few friends on Facebook (<100), so the top of my list is the usual suspects. The bottom of the list has a whole bunch of people I don’t know…

  57. This is very interesting, and I’d love to know how they calculate this. Great find!

    There was a random person that appeared quite high up (at #50 with a score of ~0.12), so that I had never heard of – I checked her page and we had 10 mutual friends. I’m wondering if this is maybe a result of her recently checking my page (perhaps I was recently one of her ‘suggested friends’), or because other friends have recently added her, as I know there are plenty of other people with more mutual friends that weren’t anywhere near as high up in the list.

  58. There is definitely something going on with the names with the numbers above 1.0

    Id like to think that Facebook wouldnt actually have a “who is visiting your profile” anywhere near client side given all the scams. My guess is this has to do maybe with people they think you might want to be connected with?

    But just looking at my list there is a clear demarcation between >1.0 and <1.0 for the index.

  59. Pingback: Lista secreta revela o seu lado Stalker no Facebook; veja o tutorial aqui! | InsideTechno
  60. It seems to be ranking people that you recently interacted with much higher, so either the dataset is limited to recent activity, or it is time-weighted somehow.

  61. Pingback: ¿A quién espías más en Facebook? | Redes Sociales
  62. Pingback: Facebook mostra os perfis mais acessados por você – Social360º
  63. Thingamijigga on August 18, 2011 at 6:52 pm said:

    Damn, I need to stop FB-stalking my hot mechanic.

  64. Pingback: Here’s how Facebook keeps track of who you are stalking | ZDNet
  65. Pingback: Secret List on Facebook | Project SAFE!
  66. Pingback: Bookmarklet Lets Facebook Users View the “Friend Rankings” List of Those They Interact With Most
  67. Pingback: Bug no Facebook te mostra em quem você está mais interessado « Amigo leitor
  68. Pingback: How To Reveal a Secret Facebook List of People You’ve Been Stalking
  69. Pingback: Code reveals your Facebook stalking victims | National Cyber Security
  70. Pingback: Secret file shows how Facebook ranks search results | CurrentNewsToday.Info – News Portal
  71. This is great, though to get it to work I used Firebug. I opened the console, then the command line and executed basically your code:

    var script=document.createElement(‘script’);

    And it worked like a charm.
    Very nice hack!

  72. Pingback: Facebook’s EdgeRank Affinity Revealed? | EdgeRank Checker
  73. Pingback: Find Out Who Facebook Thinks You’re Searching For
  74. Pingback: Who are you stalking on Facebook? | JoshCoats.net
  75. Pingback: Find Out Who Facebook Thinks You’re Searching For – Facebook Is Down
  76. Pingback: Bookmarklet Lets Facebook Users View the “Friend Rankings” List of Those They Interact With Most » Brenda Cares Corner
  77. The list doesn’t make a lot of sense. The top few are correct, but after that it doesn’t make much sense. The order is all wrong

  78. Think about it dude. “Graph” API. Edges. Nodes/vertices. A discrete mathematician’s or computer scientist’s wet dream, to fiddle with these things and play god and architect how people interact online. Of COURSE they measure all of this shit… they run the servers. They serve the pages. They write the scripts. They maintain the databases. They can do pretty much whatever they want save for reaching out and touching you.

  79. Shocking, but not surprising results when I thought about it a little. It looks like some of them ranked higher from viewing lots of photos.

  80. Bit more insight, someone who I know reasonably well in real life but have no mutual friends and I am sure that I have never looked for (didn’t even know full name) appears near the bottom (top? highest number) on the list. So others searching you must have quite an effect.

  81. suspicious on August 19, 2011 at 2:52 am said:

    Can you please post the source of the javascript file from your blog that it runs? I’m not running unknown scripts on facebook.

  82. Thanks very brilliant!

  83. Pingback: Facebook väljer dina vänner » Nerdbloggen
  84. Pingback: Vilka följer mest du på FB | Tobias Johanssons Blogg
  85. Pingback: Bookmarklet Lets Facebook Users View the “Friend Rankings” List of Those They Interact With Most | Andy Knott | Digital Business Advisor & Consultant
  86. Pingback: Frankie Hollywood and The Morning BOUNCE
  87. Pingback: Facebook sa chi è il tuo migliore amico
  88. Pingback: | Blog | Bookmarklet Lets Facebook Users View the “Friend Rankings” List of Those They Interact With Most
  89. Pingback: Classifica Amici Facebook
  90. I don’t think it is showing other people that have looked at you. The people at the top of my list have all participated in conversations with friends I have interacted with recently. This list is friends, and friends of friends and also friends adding new people to their lists. There is a particular person high on my list that a lot of my friends know and they have been adding him, because it appears as “friend has added” regularly on my news feed this is why they are high.

  91. Pingback: Secret file shows how Facebook ranks search results | The Secret – news and articles.
  92. Daniel on August 19, 2011 at 11:45 am said:

    Works very well with Windows XP Home. Firefox 6.0.

    Order and content of the list makes intuitive sense. A friend-of-a-friend, whose music I like, whose page I just looked at, is at the top. Friends I have not looked at for a long time are at the bottom. Fascinating.

  93. sre sre on August 19, 2011 at 12:46 pm said:

    what does the numbers mean?

  94. Pingback: Jubal’s News | Brooke & Jubal In The Morning
  95. john smith on August 19, 2011 at 1:45 pm said:

    How can I restore the settings?
    This turned out to messup my FF, Chrome and even Safari. I cannot access to FB anymore. All I get is an incomplete initial page loading screen with all the layout dispersed.

    Help anyone?

    Mac OSX 10.6.7

  96. Robert on August 19, 2011 at 1:49 pm said:

    Boo, does this not work anymore? I tried the bookmarklet and pasting the javascript into a new tab and…nothing.

  97. Pingback: There’s A Way To See Who You Stalk On Facebook – COUNTRY 107.7 WGNA-FM
  98. Pingback: Want to See a Secret List of Who You’re Stalking On Facebook? It’s Easy . . . And It’s Not a Scam
  99. I doubt the accuracy as there are people in there whom i hardly see on FB even! The 4th person on my list i have commented on once and he is not even really active, or in any case i cannot remember the last update he had on FB. Whereas my boyfriend is number 3 only….i am tagged in pics with him, emailed with him, commented on his status and we both wrote on mutual friends’ walls… how can it be that he ranks only one place higher then this guy i have been in touch with on fb perhaps once??

  100. Pingback: Friday Social Scoop #7 |
  101. Pingback: Facebook venner… | Lars Rønning
  102. How do you do this with Internet Explorer?

  103. I have also figured out some Facebook hacks.. I have complied code to allow you to inject a song into your status update ON YOUR MAIN PAGE… No stupid App pages… I can also inject flash games into status’s as well as “shout boxes” which in turn can connect to a blog for twice the hits…..
    Proof on my blog…

    Nice find though J


Incoming search terms for the article:

2 Responses to “Who does Facebook think you are searching for?”

  1. Kevin said:

    doesnt work on 2012 facebook version :(

  2. Me said:

    Works on IE as well.

Leave a Reply