Facebook Twitter Gplus LinkedIn RSS
Home » Advertising » Using Both iAd and AdMob in an iPhone App

Using Both iAd and AdMob in an iPhone App

Published on April 5th, 2012 by in Advertising, Blog

WARNING: I was most likely banned from AdSense and AdMob for this!! Read about it here.

Every developer is faced with the necessary evil of advertisements. It’s a fine line. Generally, people will accept a single banner on a free App, but put a banner on a paid App, and a lot of people become unhappy. Likewise, too many Ads, even on a free App, can turn off a ton of users. On a small screen like the iPhone, or any mobile device really, one Ad is generally the limit.

Ever since I began developing iPhone Apps, I’ve put iAd in my zApps. Compared to the defacto AdSense (the text-based ads used on websites), I make a lot more money with iAd.

Unfortunately though, despite paying well, iAd has a reputation for bad fill rates. For those unaccustomed to advertisement lingo, fill rate is the percentage in which ads are displayed when requested. Think of it this way. An advertiser might pay some lump sum, let’s say 1 million dollars, for their Ad to be shown 10 million times over the course of a month. If iAd is doing really popular in this case, and hundreds of Apps are displaying this advertisement, we could easily get to 10 million views before the month’s end. After that though, Apple ain’t gonna just keep displaying the ad for free. So your App might request an Ad, but there might be no Ad to display.

In the case of my Whipped zApp, a large portion of my users are in Australia. One might theorize they need the whip handy while roaming the Outback? Anyhow, iAd does not have an Ad campaign available in Australia, so every time a user in that country requests an Ad, iAd’s fill rate goes down, and I make nothing.

Thus the logical thing is to find an Advertiser that displays Ads in Australia. Additionally, if we can get our code to display a backup Ad when iAd can’t fulfill a request for any reason, then we can recover some of that lost revenue. My Googling lead me to something called AdWhirl, however, after much research, it appears that I need to get a little too deep into the Objective-C side of things to make it work properly. AdWhirl seems really cool though. The concept is exactly what is needed. You can queue up to 11 different Mobile Advertisers, give them weighted preference values, and then be guaranteed to always display an Ad.

Since I wasn’t able to make this work, I decided to explore adding another Advertiser to the code. I figured I could display their Ad and call on iAd at the same time. If iAd returns an Ad, then I display it over-top of the lesser Ad since iAd pays a lot better. As most advertisers aren’t a fan of covering an Ad, I decided to let the initial Ad display for 30 seconds before calling on iAd. This seemed no different then rotating advertisements, and I end up making sure an Ad is displayed.

Well the obvious choice was to implement AdMob, which is Google’s Mobile Advertisement campaign. I was a little shocked to see that they didn’t mind you using it in an iPhone App, or rather Apple doesn’t mind you using a Google Advertisement in an iPhone app. However, you can’t use iAd in an Android App. Funny, huh?

The code for AdMob is simple, as it is just plain old javascript that is embedded into HTML.

<script type="text/javascript"> var admob_vars = { pubid: 'xxxxxxxxxxxxxxxx', // publisher id bgcolor: '7F90AA', // background color (hex) text: 'FFFFFF', // font-color (hex) test: true // test mode, set to false to receive live ads }; </script><br /> <script src="http://mmv.admob.com/static/iphone/iadmob.js" type="text/javascript" ></script>

Of course, you need to sign up at the AdMob site to get your own “pubid”. Put this anywhere in your code to test. Make sure you change the “test” parameter in the code above to “false” before submitting your app to the App Store or you will be kicking yourself for another week while you wait for re-approval.

If you need a copy of my iAd Plugin code for Cordova/Phonegap, that can be downloaded below.

[download id=1 format=1]

About the Author: Sprawl

Stephen Russell is a Mobile App developer and all around IT geek that spends his days running data centers and his nights coding. This site is the go to place for all of zSprawl's work and the infamous development blog. In his free time, he enjoys tinkering with web code, playing video games, and otherwise plotting to take over the Internets.


Leave a Reply

Your email address will not be published.

© 2012 zSprawl's zApps

Fork me on GitHub