Weekend Project: Facebook Shares Counter
Over the weekend a Hacker News post caught my eye showing a simple way to use the Facebook Graph API to get basic statistics on link shares through Facebook. We thought this could be something really useful to our clients, being able to view a links share count using the Facebook Graph could really help them view the effectiveness of social campaigns.
So useful in fact that we quickly knocked up an interface to make it even simpler. You can view the result at shares.labs.wearestac.com.
It’s not perfect, there are some URL’s which don’t play too nicely (or Facebook returns no results) – but it’s interesting to see the ones that do. Underneath it’s just a simple application which calls the Facebook Graph object for a given URL. For example:
http://graph.facebook.com/http://mashable.com
Would provide us with the share count (and comment count where applicable) for the URL object:
{ "id" : "http:\/\/mashable.com\/", "shares" : 5237, "comments" : 40 }
Note that you can also permalink a query, using the link provided below each result.
Let us know if you find any quirks, we’re still experimenting with the concept.