How you can use Facebook to track your friends’ sleeping habits

Søren Louv-Jansen
Feb 21, 2016 · 3 min read

Like most of my friends, I use Facebook on a daily level. I use the website, the Facebook app, and the Messenger app. It should come as no surprise, that Facebook keeps track of every time you visit them through any of those means. The creepy thing is, that your friends can keep track of this too.

Last year Facebook launched — a web-based version of their Messenger app.

In the web-based Messenger, it is possible to see when a user was last active:

This person was last active 3 hours ago

I was curious about where this data was coming from, and after some digging found this — a list of user ids and timestamps of last activity [1]:

“lastActiveTimes”: {
 “3443534”: 1456065265,
 “675631492”: 1456066386,
 “8657643”: 1456062331,
 “255277634”: 1456052450,
 “6423324”: 1456065173,
 “235323452”: 1456065096,
 “3265233223”: 1456066381,
 “2432885644”: 1456064016,
 “7464340313”: 1456062500

The above can be loosely translated to: — Peter was last active on Feb 21 2016 15:34:25. — John Doe was last active on Feb 21 2016 17:15:11. — Elizabeth was last active on Feb 21 2016 10:09:55. …and so forth

By creating a simple service that checks Facebook every 10 minutes, I’m able to get an accurate picture of my friends’ Facebook usage. Many people visit Facebook as the first thing in the morning, and the last thing before going to bed. It is therefore possible to get a good impression of their sleeping habits (or lack thereof).

The sleeping habits derived from Facebook activity. This person has a fairly stable circadian rhythms, going to bed around 11PM and getting up around 6.30AM

Source code available on Github I’ve published the source code here. By cloning it you can run the service locally, and you will start seeing the sleeping patterns of your friends.

Moral of the story: We cannot hide Everybody I’ve shown this to have been equally fascinated and outraged by the accuracy with which it predicts their sleep habits. In this digital world we leave footprints where we go, and when we do it, without even thinking about it. Facebook might block this little “hack”, so your friends no longer can track you, but Facebook will always be able to do their own data analysis which is undoubtably way better than what I’ve come up with. They are likely using this data for profiling, and creating more user-specific ads.

[1] “lastActiveTimes” is embedded in the initial markup of Simply go to and click “View Source” to see for yourself.

Thanks to Vanja, Lasse and Jakob for proofreading and inputs.

Søren Louv-Jansen

Written by

Developer @Elastic. Tech tinkerer, entrepreneur and avid footballer ⚽️