Integrating Adsense for games into your OpenFL game

I have moved from CPMStar to Adsense for games a month ago and started to earn around 3-5 times more from the same number of clicks/impressions.
Although, it always depends on who plays your games, I suggest to try AFG, if you have such opportunity.

Here is a quick tutorial on how to use AFG with Haxe/OpenFL.

0. “AdSense for games allows you to earn money from your web-based games. AdSense for games uses Google’s Interactive Media Ads (IMA) SDK, the technology used to request ads from within your Flash-based game launcher.”
I have only tried AFG on Flash platform, but IMA SDK also available for iOS, Android and HTML5.

1. Download ima_lib_as3.swc file here: https://developers.google.com/interactive-media-ads/downloads

2. Place ima_lib_as3.swc file in assets folder and add the following line to your application.xml file:

<haxeflag name="-swf-lib assets/ima_lib_as3.swc" if="flash" />

3. Create your Ad Tag at Adsense Dashboard, you can test it here: https://developers.google.com/interactive-media-ads/docs/vastinspector_dual

4. Integrate AFG using this Quick Start Guide: https://developers.google.com/interactive-media-ads/docs/sdks/flash/v3/quickstart
Don’t forget to convert AS3 code to Haxe. 🙂

5. Most likely you won’t see any ads, when you test your game in standalone Flash player.
You have to integrate the game into the web page (and upload it to your website) and set the following flag:

allowScriptAccess="always"

6. If everything’s made correctly you will see ads like in my Rainbow Lines game.

P.S.: One of the requirements for using AFG is to “Have a high volume of games content, i.e., greater than 70% games content with over 2 million games impressions monthly.”
As Google has recently combined Adsense with Admob, your Admob impressions also count. (I suppose 🙂 )

Leave a Reply

DISCLAIMER: The content in this blog represents the opinion of the author. No information here should be used for any purpose except for entertainment.