Launching Your Application in facebook Complete information on it

Launching Your Application in facebook

Although launching a Facebook application is relatively easy (you just allow people to add the application and submit it to Facebook to be listed), there are several last considerations before releasing your code into the wild. Creating the About Page The About page is where your users first learn about your application. A concise explanation of your application and what it does is important, but you also need to catch your potential user’s attention. For instance, there are a set of popular Facebook applications that extend the default functionality of Facebook. These have names like SuperPoke, Super Wall, and Top Friends. Give your application name some thought. Be clever, but not too clever as to obfuscate the true nature of your application. Your About page also has several sections that you need to visit (or subscribe to). The forums are a great place for people to ask you about what’s going on, how to improve the application, and what to do when things aren’t clearly planned out in a logical fashion. These are a great way for you to communicate with your users, but remember, Facebook users can, at times, be fickle, so they will most likely just uninstall your application if they don’t find it useful. Creating a Logo Designing a logo can be a bear for programmers (just like programming can be a chore for designers). At the least, you should be able to implement a Web 2.0 badge (there are a lot of online versions of these generators). If your icon version doesn’t look right, there are several open source icon libraries. Tango’s Icon Library ( and FamFamFam’s Silk Icons ( are two popular sets that you can use in your application. If you’re a designer, the sky is the limit. Just make sure you have images for all the different sizes that can go into different areas of the web site (from 16 X 16 on up). There aren’t really any guidelines, but be aware that any image published through the Facebook platform gets cached on Facebook’s server. If you update your image and it doesn’t immediately take (and you’re impatient like I am), call the facebook.fbml.refreshImgSrc API method (for example, $facebook->api_client->fbml_refreshImgSrc($image_url) function). 126 Building a Facebook Application, Start to Finish Submitting for Approval Once you’re finished with your application, it’s time to submit it to the Facebook approvers. Log on to the Developer application (, and edit your settings so that everyone can add your application. Then simply click the Submit Application button. It generally takes a few days for the people who approve applications to respond. They’re looking at the application to make sure it’s appropriate for their terms of service (in case you forgot to read them, here’s the link After it’s been approved, people will be able to find your application on the main application page ( Publicizing Your Application Facebook is a viral community. The first step in getting folks to use your application is to get your friends to start using your application. Then, you need to get your friends to tell their friends about the application. However, you can also get others by purchasing Social Ads from Facebook ( Advanced Techniques When you start developing applications, you’ll notice that there are a lot of things that you do repeatedly. For instance, for every application you create, you’ll be coding the inserting, deleting, update, and reading of the data in your tables. After a while, this can become annoying. This is where the various frameworks come into play. CakePHP and symfony are two popular PHP web application frameworks that can easily be integrated into your Facebook application. These frameworks remove a layer of monotony from developing, allowing you to focus your efforts on developing “real” code, rather than repetitive SQL statements, confusing conditional statements in your pages, and implementing MVC patterns to “simplify” your code. If you haven’t taken some time to sit down with either of these, it is well worth it because they will save you time in future development. Another element to explore is migrating your data to Facebook’s Data Store API. By using Facebook to store your data (and back it up), you have access to Facebook’s scalable data storage servers. You may also want to look at Amazon’s SimpleDB, but you should probably start with Facebook unless you have objections to Facebook “owning” the data for your application. Building a Facebook Application, Start to Finish 127

Summary We covered a lot of ground in this chapter. You created an application all the way from start to finish using Eclipse, MySQL, PHP, and the Facebook platform. I discussed some of the issues you can run into when developing an application and how to deal with code that’s not behaving as expected. Although I didn’t walk you completely through the code to post reviews, you should know enough to complete this on your own very quickly (or build upon it for your own application). In the next, final chapter, I’ll go over some ways to track how many people are using your application and how you can turn this into a little extra revenue. 128 Building a Facebook Application, Start to Finish CHAPTER 5 Going Further with Your Application In previous chapters, I covered the meat and potatoes of creating Facebook applications. In this chapter, I’ll shift the focus a bit to the salt and pepper by covering the resources that you can use to analyze your application statistics, where to go if you get stuck, and, perhaps most important, how to generate a revenue stream from your application! Although some applications have sold for quite a bit of money and some generate a good revenue stream from advertisements, it’s important to remember that most likely you’re not going to make a $1,000,000 with your Facebook application, because many mitigating circumstances contribute to the success of turning an application into a blockbuster. However, with some planning and some good choices, you should be able to at least offset the costs of your server hosting. Application Statistics Facebook provides a basic statistics feature in the Facebook Developer application to help you get an idea of what’s going on with your application. These statistics include usage statistics, HTTP status requests, and recent HTTP requests. Within the usage statistics, you are provided with a helpful User Engagement statistic that tells you how many people used your application in the past 24 hours. Although the total number of users of an application may be quite high, this engagement number is important because it helps you figure out how many people are actually “using” your application. If this number isn’t very high, chances that the application will be able to sustain itself are reasonably low. What if you need or want more sophisticated statistics? This is where the tag comes in handy. You will need to create an account on Google Analytics to use this tag, but it’s quite simple to use, and it provides exceptionally detailed statistics about your application (and for that matter, any web site you might build). If you don’t already have a Google Analytics account, navigate to You need a Google account to use Google Analytics, so if you don’t already have one, you can sign up by clicking the Sign Up Now link in the middle of the page, as shown in Figure 5-1. 130 Going Further with Your Application Figure 5-1. Google Analytics sign-up link Once you have an account set up, the next step is to add a web site profile. Simply click the Add Website Profile link after logging in to start the process. Then fill out the form for a new domain using your server URL (not your URL), as shown in Figure 5-2, and click Continue. Figure 5-2. Google Analytics site registration Going Further with Your Application 131 After you’ve registered your site, you’re presented with a small snippet of JavaScript to add to your page. But wait, you can’t use this because it’s not FBJS! So, just get the account number (defined by the _uacct variable) to use the tag, and let Facebook write this in for you (see Figure 5-3). Figure 5-3. Google-provided source code including Google Analytics account number Now, in your application, you merely add the following to produce the required JavaScript in your application: When used in your application, Facebook will add the correct JavaScript to the resultant HTML stream. You may even want to define this in a global include (just in case you write a new page and forget to add the code to track its usage). You also have access to the Google Analytics tracker in FBJS with the Facebook.urchinTracker object in case you need it. Most of the time it will be a lot easier to use the tag than to implement your own methods through FBJS; however, should you need more granular control over what gets sent to the Google servers for your application, the functionality does exist. Once you’ve added the tag to your application, it typically takes about 24 hours for an update to occur and for you to see any statistics. Google Analytics will provide you with a really great statistics set including a site overlay (you want to make sure your features/ads are properly placed), geotargeting (to see where your users are from), Google AdWords integration, and just about any other type of useful statistic that you could possibly want about the people using your application. Monetizing Facebook has worked into its service agreements to allow application developers to monetize their applications. When you start looking at the different options available to 132 Going Further with Your Application you, you may find rather quickly that your head starts spinning from the sheer volume of advertising alternatives. The following is a brief treatment of some of the more popular ways developers have helped defray their costs. AdSense Since you’ve set up a Google Analytics account, it’s not that much more effort to enable Google AdSense. You first go to the AdSense web site at You’ll notice that if you’re signed in to other Google services (Gmail, iGoogle, Analytics, and so on), you’ll still need to create a separate AdSense account. Simply click the large Sign Up Now button (if you don’t already have an account). Don’t worry, you are presented with the option to use your Google account information if you choose. After you’ve filled in the information needed in the application, it typically takes a day or two to be reviewed. Once you’ve set up an AdSense account and filled out the appropriate tax forms, you need to decide what type of advertising you want to implement. Google provides ads for content, search, referrals, video, and mobile content. What your application is doing will drive your decision here. Since Facebook has implemented a really nice mobile version of its application, you can always use the mobile content in your application! Google also provides you with some options for your ads (text and images or text or images only), so once you’ve decided which one you want, choose a size and color palette that matches your overall application design. Tip ➡ Blue Mix works well with the default Facebook color scheme. You do need to make a small change to at least your main canvas page to get relevant ads from Google: you need to make it publicly available so it can be crawled by Google. Unfortunately, there’s no tag (and there probably will never be one), so you have to hack your page a bit to make things work. So, let’s make your canvas page publicly visible. The big change from the code in the previous chapter is that you’re no longer going to be using the require_login function in the Facebook object. You’ll use the get_loggedin_user function instead: // $user = $facebook->require_login(); $user = $facebook->get_loggedin_user(); Now, if you want to test whether a user is logged out, you can use this: $is_logged_out = !$user; Going Further with Your Application 133 You can use any of the canvas page tags on this page without any changes to your code, although you might need to refactor some of your existing code to see how it appears for non-logged-in users. Now I’ll discuss the iframe hack to use AdSense. You need to make a new page that contains the JavaScript that Google provides you when you generate the ads for your page on your web site, and then you need to call that page through the tag on your canvas page. So, let’s say you’ve created a page on your site named ads.php and can get to the file at Now, simply insert the following where you want to place the ads: If you’re having problems with relevant ads, you might also want to use Google hints. You’ll need to edit the JavaScript code that AdSense provides you and define the google_hints variable with a comma-delimited list of keywords for your application. In other words, you’ll want to hack your AdSense code to resemble something along the lines of this: The nice aspect of AdSense is that its ads are unobtrusive and can be placed nearly anywhere on a page. It also offers nice tools for tracking your earnings and growth over time. Although other sites might make you more money in the short run, AdSense has a proven ability to generate revenue, so you’ll want to consider that when deciding what advertising folks to partner with. Amazon Amazon also has a great service to generate revenue streams in its Amazon Associates Web Service. You’ve already used part of Amazon’s service to pull the images from Amazon, so in this instance you might be able to use this service to build specialized URLs to provide 134 Going Further with Your Application links to Amazon so users can purchase different games from the sample application (or anything else Amazon sells, for that matter). Since you already have the ASIN stored in your database, you can easily generate a link to the store with your Associate’s ID embedded in the link. The resulting anchor for the image brought in by the Amazon web service is as follows: This service won’t work for every type of application. It works well for social review applications, but it might not work as well in other types. You may find that some of the widgets on the Affiliates web site ( will work well for your application, and you’ll notice that many of these widgets (under the Build Links/Widgets section) generate JavaScript. But again, the hack shown in the “AdSense” section is generally the recommended way to go. Adonomics Formally known as Appaholic, Adonomics provides “stock-market-style” analysis for your applications. This site provides a few different services. The first is a service to get people to install your application. There are multiple tiers of this that range from $5,000 to $480,000. If you’re looking to build users for your application, this may very well be worth the cost. However, if you’re thinking smaller, Adonomics also rents advertising space. This is great since Adonomics takes on finding the advertising clients for the different places in your application. To give some rough estimates, Adonomics claims an average of about $3.60 per user per year (about $0.30 per month per the number of active users for the previous month). Of course, your mileage may vary. Others You can use many of other services to generate revenue from your application. Although I can’t get into all the various services in this book, here is a list of some others you might want to investigate: • AdBrite ( • Appsaholic ( • BannerConnect ( Going Further with Your Application 135 • Chitika ( • Cubics ( • fbExchange ( • Neverblue ( • PeanutLabs ( • Survey Savvy ( • Zohark Ads ( Developers have differing opinions about each of these companies, and being listing here isn’t necessarily an endorsement (and if I’ve missed your company, I apologize). Rather, this is a list to help you get up to speed on the different companies that allow you to leverage their advertising in your application. Advertising Tips You may notice that there are some advertising strategies that work better on your site. If your users are all using Firefox with the Adblock add-on, most likely they won’t see the advertising. Also, some agreements (such as the Google AdSense agreement) won’t allow you to use multiple types of advertising. So, choose your advertising service carefully. Although it’s a pain, it is important you read the terms of service carefully to fully understand what you’re getting into. This can translate into some long and confusing reading, but having a good understanding of these terms will save you many headaches down the road. Depending on your service agreement, you may or may not have much control on where your advertisements are placed. If you can, place your ads near rich media (that is, images) so that the user’s eye is drawn to the resource. You will also want to integrate your advertising into the overall design; don’t put in the ads as an afterthought! Here are some general rules (or perhaps, more accurately, observations) on what works: • Ads at the top of the page do better than ads at the bottom. • Ads near images and navigation do well since the user focuses on those areas. • Ads that have long areas of text (that is, stories) do well placed at the bottom. There are no hard-and-fast rules for integrating advertising into your web site. However, pay attention to what’s going on through whatever tools your advertising supplier provides. 136 Going Further with Your Application Selling Your Application Another way to make some money from your application is to sell it. However, remember that the people you’re selling it to are expecting to make more money off your application than they are paying you. You need to either build your application to maturity and show sustained growth or come up with some type of novel method that has a lot of promise. If you think you’ve built a killer application that has a lot more potential and, for whatever reason, want to sell your stake, here are a few places to start looking for a buyer: • Altura ( • AppFactory ( • EBay ( Help, I’m Stuck! (and Other Resources) So, you’ve gotten partway through your application, and there’s this one little thing you just can’t figure out how to implement. What do you do? Probably the single best resource for these types of problems is the Facebook Developers forum (or discussion board, depending on where you link from) at If you’re more comfortable on IRC, there’s also a channel on freenode (#Facebook) where lots of folks hang out. This can (at times) be a faster way to get an answer to a specific question (though people may send you to the forums, so make sure you search them before you post a “n00b” question). You may also want to check out the different Facebook developer groups ( or even ask questions at one of the Garage events ( Summary Making a little bit of money on the side never hurt anyone, and in this chapter I briefly went over some avenues that are available to you as a Facebook developer to monetize your application. You saw how to easily integrate advertisements into your application with Google AdSense and how to use Amazon’s affiliate program to help generate a revenue stream for your application. Because Amazon and Google aren’t the only players on the block, I also listed some other advertising agencies that many Facebook developers have used. It is important, however, to compare the different agreements to each other in order to find the right Going Further with Your Application 137 solution for your application. And, if you get to the point of wanting to sell your application, I listed a few avenues for you to pursue. Remember, the vast majority of applications don’t create additional value to Facebook. If you want to sell your application, remember this altruism: Facebook isn’t about content…it’s about communication. Do something that Facebook lacks, or do it better than Facebook does it, and you’ll be successful. If you get stuck, remember that the forums and the wiki documentation are your friends. You can also drop me a line via Facebook (be sure to add me as a friend) with any comments. Good luck with your project!

No comments