Hiding your birthday on facebook

We share many information on Facebook, such as name, country, date of birth, and other details, personal or not. After all, Facebook wants to make the world more open.

However, I believe that there are still legit reasons for people to keep certain information to themselves. Sometimes, it’s an obvious judgement of whether certain information should be available (to friends) or not, but some other times, it is less clear. One such information that this post is concern about is birth date. Birth date is something that is not guarded against that strongly. After all, you share that information with your close friends, and it is on most identification card (to check if you’re legal to buy alcohol). As a result, most people are willing to share their birth date online, and may not be aware (or don’t really care) that they are making it accessible to people who are less than close friends.

What’s the harm there, you might ask. The risk here is possible identity theft. Some services try to authenticate you by asking you to verify your birth date (among other things, which can also be stolen in a similar manner). Some password recovery system for online services and call centers comes to mind.

That’s silly, I hear you say. But sometimes we willingly use our birth dates as an authentication method. For example, when choosing a memorable pin, birth date is a perfect candidate! (I’m sure most readers would have used their birth dates as their phone unlock PIN at least once). It’s all about risks, weighing the cost and benefits of using complex PINs.

A research was done on the distribution of 4-digit PINs, which shows that PINs are not as random as they should be. The following diagram shows the distribution of 4-digit PINs, the x-axis is for the first two digits, while the y-axis is for the last two digits.


What readers would notice is that the dark regions, which represents high frequency, are not randomly distributed. For instance, we see that the dark vertical line corresponds to 19xx where xx is from the range 40 to 99. One might guess that it corresponds to birth year. The next observation is that at the bottom left there is a dark corner, almost like an L-shape. Here we see the boundaries are 30 and 12, corresponding to the number of days and months. It is not too far fetched to conclude that users probably use their birth dates as their PINs.

Would you make your PIN accessible to your friends (or acquaintances) on Facebook? If the answer is no, then it is sensible that people shouldn’t readily reveal their birth date on Facebook.

So I started a journey to try and make it harder for people who didn’t know me well to figure out my birth date. It starts with setting the visibility of birth date to “only me”. But I realised even without explicitly stating my birth date, an intelligent person might browse through my news feed and find out when people sent birthday greetings to me, hence deduce my birth date. (I have tried this one some of my Facebook friends and have successfully inferred their birth date despite not having direct access to that information on their “about” page.) So the next sensible thing to do in this endeavour is to hide those posts.

Annoyingly, Facebook doesn’t have the feature for people to hide multiple posts, and I wasn’t going to click through hundreds of birthday wishes just to hide them. So I decided to use some javascript to automate that process.

The first step is to load jQuery, which is simple enough. Once I got jQuery, it’s a matter of selecting all the posts that have birthday greetings, such as “happy birthday”, “HAPPY BIRTHDAY”, etc, and simulate mouse clicks to change the visibility from allowed to hidden. The code that does that is described bellow.

$(".pam ").each(function(x) {
    // test is the content of the wall posts
    var test = $(this).text();
    if (test.indexOf("birthday") >= 0 || test.indexOf("BIRTHDAY") >= 0 || test.indexOf("bday") >= 0 || test.indexOf("Birthday") >= 0) {
        // t2 is the edit button which brings out the menu
        var t2 = $(this).children().children().children().children().last().children().children().last().children();
        // check if it's currently allowed on timeline
        if (t2.attr("aria-label")!==undefined && t2.attr("aria-label").indexOf("Allowed") >= 0) {
            if(t2[0].click !==undefined) 
            var n_id = t2.attr("aria-owns");
            // t3 is the button that says hide from time line
            var t3 = $($('#' + n_id).children().children().children()[2]).children()
            // check if it really is that button, or it might be a delete button, in that case the length is zero
            if(t3.length>0 && t3[0].click !==undefined) {

So after coming up with this tweak, I managed to make most posts about birthday wishes hidden from my time line. There are of course some hiccups along the way. For instance, finding the criteria for such posts proved to be not as trivial as searching for the word “birthday”. Some people might say “happy x-th” instead, but those are easy to spot from a list of circular icons and can be manually rectified later.


One thing to mention here is the posts are not lost, they are still visible when I look through my own time line – so I can look back and reminisce on people sending me wishes. But at least it is currently more difficult to know my birth date without asking me.

The trade off between privacy and convenience is inevitable. In making my birth date private, I have made it difficult for people to send me birthday wishes on my birthday (without Facebook reminding them to do so). But I think I can make do without that social contract, and not make people feel bad by giving them an excuse – “because Facebook didn’t remind me to”. Similarly, I stopped posting birthday wishes on Facebook because I would be hypocritical to do that. This is probably also a good way to filter your friends to people who actually bother to remember your birthday. But readers be warned, you might not like what you learn.

To conclude, this method illustrates the usefulness of knowing some programming languages to automate mundane tasks such as the one I was trying to complete. It is a simple modification to change it to hide posts that meet some other conditions, or even like all posts from a person! (way to show that you actually appreciate their posts)


Published by

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s