Just thought I’d make mention of the fact that I’m currently working on a little AIR based app to pull down a user’s usage stats from iiNet and display them in sexy looking progress bars and charts. One thing that piqued my curiosity is weather or not Google Adsense ads could be added to the app to generate a bit of revenue.
After a bit of experimenting I found that the code won’t run at all from the standard application sandbox, but will run perfectly in the non-application sandbox, provided you specify a valid url as the sandboxRoot.
So in your main app window you add an iframe to a non-application sandbox based url:
<iframe id=”adsense” src=”adsense.html” sandboxRoot=”http://www.eltomtom.com/” documentRoot=”app:/” frameborder=”0″></iframe>
Then in your adsense.html file simply embed the adsense code as normal:
/** google adsense code */
google_ad_client = “XXXXX”;
/* 20090312 AIR Banneer Black */
google_ad_slot = “XXXXX”;
google_ad_width = 728;
google_ad_height = 90;
After getting the code to work of course the next step is to check views and click throughs are actually being counted, as google could have been doing some form of user agent filtering, but sure enough clicks and views are counted fine. When you click on the ads the html page actually pops up in a new chromed AIR window, which I thought was a nice touch.
The one caveat I’ve found is that you can’t use the rounded corners of the adsense code, which throws errors in AIR.
Anyway I think combining the ease of development of AIR based applications, coupled with Google Adsense, makes for a very appealing revenue model for application development, and one I’m keen to explore further over the coming months. Stay tuned!