They used the Facebook app to spy on smartphone users and detect Instagram and WhatsApp success to decide to buy them.