Is a Facebook friend tracking your sleeping habits?


If you’re a Facebook addict, it’s simple for your friends to track when you sleep.

That’s been shown by Danish software developer Søren Louv-Jansen, who’s released a tool that uses a simple string of code in Messenger to suss out his friends’ sleep cycles.

It’s most effective when tracking frequent users: those people who check Facebook right before their heads hit the pillow at night and then reach for their mobile phones to check it first thing when they wake up.

That type of user is pretty common. A 2013 report concluded that four out of five mobile phone users check their phones within the first 15 minutes of waking up, and 80% of them say it’s the first thing they do in the morning.

Louv-Jansen told the Washington Post that he was inspired to create the sleep tracker by his girlfriend’s frustration over her Facebook friends being able to see when she was last active on the platform.

After digging around, he found that Facebook stores timestamps that display when users were last active on Facebook and Messenger.

This only pertains to people in your own network. Your friends can suss out when you sleep (if you’re an active user), and you can do that to them, but people outside of your network can’t get at this data.

Louv-Jansen said he worked on the project on and off for five or six months.

He released the tool in December, but not many people noticed it until 10 days ago, when he published a related post on Medium.

As he described in the post, Louv-Jansen came across snippets of code on that reveal when a user in his network was last active.

He gave this example: Searching for the string “lastActiveTimes” in the source code for the site yields up something like this:

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

…which is a list of user IDs (between the quotes) and the last time they were active (after the colon).


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

He created a simple service to check Facebook every 10 minutes for the timestamp of his contacts’ most recent activity, which the tool uses to create a visual map of their circadian rhythms.

The developer told the Washington Post that the tool worked extremely well on 30% of his friends, and somewhat effectively on the remaining 70%.

He also found sleep patterns to be consistent Monday through Friday, but random on weekends.

Louv-Jansen isn’t a creepy stalker, he says. He just wanted to get across what kind of digital trail we’re leaving.

The Washington Post quotes him:

My point was not to spy on my friends. I want people to be aware that they’re leaving some digital footsteps everywhere they go.

Some have opined that the point of reverse-engineering Facebook’s code to get into its internal API to then stalk his friends is, in fact, spying.

It’s worth noting that Facebook isn’t the only web service that’s ever used timestamps: Twitter, for example, timestamps posts, though it doesn’t timestamp when users have last signed on.

For a few years, Facebook has been giving people the “lastActiveTimes” timestamp in order to give them a reasonable expectation of when they can expect a reply.

If somebody hasn’t been signed in for a few hours, a message sender knows they’re not likely to get a speedy reply, for example.

Facebook contacted Louv-Jansen a few times to let him know that he’s violating its terms of service, to ask him to stop scraping the data, and to please discourage others from using his tool to scrape their friends’ data off of the site.

A Facebook spokesperson sent this statement:

Our terms prohibit collecting people’s content or information or otherwise accessing Messenger using automated means without our prior permission. This integration violates those terms – as the developer alluded to in his post – and we’ve reached out to the developer to ask him to take it down. Messenger cares deeply about protecting people’s privacy. That’s why only people you’re Facebook friends with, have added as a Messenger contact or who you’ve messaged before can see when you were last active.

Facebook’s terms of service prohibit collecting people’s content or information, or otherwise accessing Facebook (including Messenger) by automated means, such as harvesting bots, robots, spiders, or scrapers, without Facebook’s prior permission.

Louv-Jansen has stopped using the tool himself, he said, but he’s refusing to remove it from GitHub.

Louv-Jansen said he’s not proud of enabling spying, but he does want to raise awareness of what’s possible.

From the Washington Post:

I’m not proud of people starting to spy on their friends. But maybe this can make everybody more aware of the consequences of our actions.

Image of Woman sleeping courtesy of