As of the latest version of the Moai SDK (0.4, revision 11), Tapjoy has been implemented for your use. Find out how using Tapjoy can help increase your app's revenue.

A quick check of the highest grossing iPhone apps on any particular day will show you that the top ten is dominated by free games with in-app purchases, with only a few paid apps (usually Angry Birds) on the list. But if they're giving their games away for free, how do they earn so much revenue?

The most profitable freemium games generally feature one or two types of in-game currency that the players spend to unlock more game content, be it more levels, power-ups, or new characters. This currency can be obtained through normal play or players can purchase in-game currency with real money, essentially allowing the players to choose how much value they find in the game. Get Set Games, creators of Mega Jump, discovered that they made more money off of in-game purchases when their title went freemium than they were ever seeing when the game was a premium title with in-game purchases. Some players, however, are still wary of paying money for something in a free game (or even a paid game). This is where Tapjoy come into the picture. Tapjoy is the leader in monetization services for social and mobile gaming applications. Tapjoy is a free service that developers can sign up for that will allow them to display offers to users and offer in-game currency for completing them. The offers range from “download X free application” to “download X free game and beat level 1”. After the users complete the offers and get their in-game currency, you, as the developer, will receive money. In October of 2010, Glu Mobile launched Gun Bros integrated with Tapjoy, and it quickly became their top-revenue producing freemium title for the fourth quarter. With all of this in mind, Zipline has partnered with Tapjoy to streamline the process of signing up for their service and we’ve also included a simple-to-use module to take advantage of various services that Tapjoy offers. (Note: Tapjoy integration is only up and running for iOS as of Moai SDK 0.4 Revision 10. Android support for Tapjoy services is coming very soon.) Talk about this article here!

How to sign up for Tapjoy

Moai users can actually sign up for an account with Tapjoy with one click during the initial sign up process. After the initial registration page, you will be taken to a screen explaining both Tapjoy and Apsalar (a blog post about Apsalar will be coming soon), and by simply clicking on the “Add Monetization” button an account will be created for you. If you decide to opt-out initially, you can still sign up by going to your account page on the Moai dashboard. A few minutes after signing up, an e-mail will be sent confirming your account and asking you to create a password. After this is done you’re all set up with a Tapjoy account.

Integrating Tapjoy into your apps

Now that you’ve got a Tapjoy account, you'll need to set up your API key and link it to your Moai Cloud account. Simply click on the "Get API key" under Partner Services on your Moai account page (also found on the Dashboard). This will take you to Tapjoy's reporting page with your API Key. Take that key, put it into the API Key texbox, and now your accounts are linked. (Note: if you are already signed up for Tapjoy, you can still link your account with your API key.) Integrating Tapjoy into your app is a simple process. To start, you will first need to include 3 lua modules (tapjoy.lua, url.lua, and util.lua) found in the include -> lua-modules folder in the Moai SDK. Then you will need to require the “tapjoy” module in your source code. After that, you’ll run

 tapjoy.init ( “App id”, “App Secret Key” ) 

This will connect your app with Tapjoy Connect. In order to get the App id and App Secret Key, you’ll have to register your app with Tapjoy. This is done by signing into Tapjoy, clicking on the Apps tab, and adding your app. This will give you the credentials you need. (Image courtesy of Tapjoy) With that, your app has is connected to Tapjoy and now you can access the various services that Tapjoy offers.

Tapjoy Services

Tapjoy offers three major sources of monetization for mobile applications. The first is the Offer Wall: Next are the banner ads: And finally the featured ads. (Images courtesy of Tapjoy) To implement these in your game, it’s as easy as using one of the tapjoy class functions. Taken from our sample in the Moai SDK, here’s how you would call the Offer Wall.

 	function showOffersWebViewCallback ( task, webView )

		webView:show ()
	end

	tapjoy.showOffersWebView ( showOffersWebViewCallback )

A Featured Ad:

 	function showFeaturedAppWebViewCallback ( task, webView )

		webView:show ()
	end

	tapjoy.showFeaturedAppWebView ( showFeaturedAppWebViewCallback )

and a banner ad:

	function getBannerAdPropCallback ( task, bannerProp )

		-- add banner ad prop to layer
		layer:insertProp ( bannerProp )

		-- set up click behavior for banner ad prop
		MOAIInputMgr.device.touch:setCallback (

			function ( eventType, id, x, y, tapCount )

				print ( layer:wndToWorld ( x, y ))

				if ( eventType == MOAITouchSensor.TOUCH_DOWN ) and bannerProp:inside ( layer:wndToWorld ( x, y )) then
					local jsonTable = MOAIJsonParser.decode ( task:getString () )
					MOAIWebView.openUrlInSafari ( jsonTable.ClickURL )
				end
			end
		)
	end

	tapjoy.getBannerAdProp ( "320x50", getBannerAdPropCallback )

Closing

If you would like to see Tapjoy in action, check out the previously mentioned Mega Jump and Gun Bros. For more information on Tapjoy, visit their website at www.tapjoy.com, or their Knowledge Center at knowledge.tapjoy.com.