Mobile ads in PhoneGap applications build with PhoneGap Build [updated]
Adding a mobile ads to monetize your mobile applications is a quite easy task, when you’re compiling your applications locally. And there were many articles written about this (like the one at PhoneGap Wiki).
But, when you compile in-the-cloud, using PhoneGap Build only, things are getting much more complicated.
Basic situation
If you have setup your local development environment and you compile your mobile applications in local PhoneGap, then you have access to Java code of the container for your HTML 5 application. You can modify it to reduce container screen dimension and place some ads in your application. This let’s you choose among many mobile ads networks, which provides SDKs for displaying their ads.
Read this extended answer to my Stack Overflow question, to get a brief discussion on most popular ones.
Things are getting a little bit complicated, when you’re building your apps with PhoneGap Build. It is much easier way (no local environment setup, only HTML5 coding and compiling in the cloud), but you have no access to container application, so above method is closed to you. The only option for placing ads in this case is to use Javascript.
And there aren’t many ads network, that let you serve their ads through pure Javascript.
Especially you can forget about most famous — AdMob or AdSense. First was allowing Javascript, but ceased this kind of service. Second one still allows to serve ads via Javascript, but ever since Google bought AdMob for mobile applications, AdSense itself has been closed completely for mobile websites and applications. And they will block your account once they discover that you’re serving their ads to mobile market.
Mentioned answer counts MobFox as the only ads provider, which satisfy both unspoken requirements — i.e. it allows to server ads via Javascript and is aimed to mobile apps and websites market. I’ve contacted their support and recevied confirmation about this.
Thus, MobFox seems to be the only solution for PhoneGap right now.
Programmableweb.com
And if any of mentioned (here or below) does not satisfy you, you may consider programmableweb.com, a promising API directory, that I ran into by a complete accident. It let’s you browse really impressive number of external API services and browse it by Category
, Protocol
, Data format
and so on.
So, for example, here is a list of API providers, currently stored in programmableweb.com‘s database, filtered by Category=Advertising
, Protocol=Javascript
and Data Format=JSON
. Something, I’ve been looking for.
I haven’t tried any of them, so above answers, with concrete examples are still valid (and new ones are most welcome). But I wanted to mark it out, that this could be a good start point for seeking an API to this or any other purpose.
Update: I’ve tried some of above and many entries are really, really old (orginating in 2006) and thus, of course out-dated or not-existing at all. Even so, I advise to use it as a good starting point, because there are many pearls among old junks there.
Update
Few weeks after fist first answer, that I got to my question, there was another one proposing Inmobi and claiming, that you can get in-app advertisement, using pure Javascript, with only three lines of code.
I haven’t tested it yet, but it really looks promising. Especially, if you take a look into its API to “Javascript Ad Code Integration – Client Side” section.