Saturday, 2 February 2008

Views: Attract more visitors by developing a facebook application

Why are you here?
What, out of the millions of web pages on this ever growing beast that is the internet made you click on a link or type in an address to arrive at this page?
It may be coincidence and you were searching for something totally different, in which case you are unlikely to have made it to this point in the post.
Hopefully this is not the case. Hopefully you are here because you want to read about why I have developed a facebook application, how I went about doing so and what lessons I learnt that I can pass on to you.



>> So why did I develop a facebook app?


For the very point I was making at the start o
f this post. To attract more visitors to this site. To gain more exposure and in turn encourage more users to sign up to this blog. In my view there is no point blogging to an audience of 1.

There are over 35.3 million Weblogs on the internet, so to make yours the one that a visitor reads means you have to do more that just post your articles and thin
k the magic of the internet will do the rest.
Facebook is the web app of the moment. It comes and goes in phases, first it was Myspace then Bebo now Facebook. Surfers are fickle creatures that will set up a new profile on the next big social networking site at the drop of a hat, leaving their existing profiles frozen at a perticular point in their lives... sad, but true.



But facebook is where it is at the moment and one of the main reasons behind this is because they
have given the power of evolving this network socialising tool to the community that use it.
They've
done this by allowing developers to build "widgets" that can be installed in users profiles and these "widgets" can be anything the developer can dream up.

It obviously hasn't
taken long for developers to realise that through these widgets they can reach a massive audience faster than ever before possible. Word of mouth is the most powerful viral marketing tool available and this platform gives a perfect way of starting that marketing. So this is the reason I set about developing a facebook app, I wanted more visitors to this website and hopefully, as you are reading this... that's already started to work!


>> How did I build the facebook app?

First of all I needed a
n idea for a facebook widget. If you're a user of the site, I'm sure you will have noticed there is an absolute deluge of widgets that let you see how you compare to your friends, how popular you are or even what object such as car, vegetable or animal you are like. These are all good fun and have their place.
But I wanted to create something that
users could get involved with and hopefully get a little more out of using.

I looked at my interests and the fact that I was trying to come up with an idea to engage more people with my website. One of my favourite shows on the box is Dragons Den, so I wondered if I could develop an app based around this show. "Pitch to the Dragons" is what I came up with. Where facebook users can pitch their idea to their friends for them to comment on and rate.


Fortunatly I have a background in php, which is one of the primary languages you can use to develop these widgets. The other language you need to become familiar with is FBML (Facebook Markup Language). This is where I really have to take my hat off to the developers of facebook. They have created an evolved subset of HTML which allows you to hook into the users profiles, mini feeds etc... and display elements in a facebook style in-keeping with the site.

I'm not going to go through the coding of my application, but I will say that with a sound knowledge of php it took me approx 18hrs to develop. Obviously this wasn't continuous I was doing it in my spare time.
That said, I am now familiar with FBML and the anatomy of a facebook app, so the next application should be a lot quicker (depending on complexity!).


>> What did I learn that I can pass on to you?


First of all that you need to download the PHP (4 and 5) Client Library. This includes many facebook functions that you will need to develop you app.
One lesson here was to make sure you know the version of php your using and therefore use the correct library.

Once you've uploaded the correct library, you may come across this error when trying to access it...
Fatal error: Failed opening required 'IsterXmlExpatNonValid.php', this is because you also need an XML library that can be found
here Make sure you reference it correctly and the error should disappear.

The second lesson I learnt was using the Default FBML which is in your applications "Edit Settings" page.
I was trying for ages to get the actions I wanted in the users profile into this box. Unfortunately its rather restricted and you can better configure what the user sees in their box through the set up when they install your app.

You really need to setFBML for the users profile. To do this in php build what you want the user to see in their profile into a variable then call your facebook api client profile_setFBML function, e.g. $facebook->api_client->profile_setFBML($markup); //where $markup is what the user will see in their profile.


Aside from these two issues, everything really did run smoothly. My only other suggestion would be to use the FBML code as much as possible to make your app look like a facebook app.

So, has it worked?
Only time will tell. I will post a follow up to let you know the difference it has made... At the moment I'm just hoping the next killer social networking application isn't going to spring up tomorrow!

No comments: