Links on Android Authority may earn us a commission. Learn more.
How to start using AdMob with Firebase to monetize your app
These days, more and more app developers are eschewing the pay-to-download business model in favor of making money from their creations in other ways. This is particularly true on Android, where users are highest in number but not quite so keen to dig deep for their favorite apps (compared with iOS users).
AdMob is one alternative option available to those developers. This is a form of PPM advertising, which means ‘Pay Per Impression’ and that means you get paid simply by displaying ads on top of your app content. AdMob is the biggest platform of its kind on Android, which is no surprise seeing as it is owned by Google. Let’s take a look at just how it works, how to set it up and whether or not it’s right for you.
How AdMob works
The precise amount of money that a click or impression gets you will depend partly on what kind of ad you choose. When setting up, you’ll have four different types to choose from:
- Banner ads
- Rewarded interstitial
- Native ads
Banner ads are simple banners that can appear over the top of your content. These are less intrusive because the user can carry on with what they’re doing. Generally, they will encourage your users to try other apps or products. When the user taps the ad, it will expand to fill the screen. Banner ads can come in a variety of sizes, to suit your UI.
Interstitials on the other hand are always full-page and will normally be inserted at natural break points in your app. So if your app focuses on written content, then your ad might show after several pages as the user transitions from one screen to the next. Alternatively, a game might place interstitial ads between levels, or when the player dies and respawns.
Rewarded interstitials meanwhile are videos that reward you for watching them. Many games for example will let you watch the advert in order to gain extra lives or attempts at a level. Finally, native ads are ads that are better integrated into the app itself and that fit into your UI. So if you had a list of images, an ad might be seamlessly inserted between two of them as users scroll through.
Choosing the right type of ad that is noticeable but not frustrating, is a big part of winning at AdMob!
How much will you earn?
So how much can you expect to make from AdMob? The answer of course depends on how popular your app is but suffice to say that it starts out pretty small, so you shouldn’t go into this thinking it’s guaranteed to be your big pay day!
Revenue from AdMob is calculated as eCPM. That stands for ‘Effective Cost Per (thousand) Impressions’, which means on average, you are making that figure from 1,000 views. This takes into account both your PPM (Pay Per thousand Impressions) and your PPC (Pay Per Click). You tend to get paid a bit more when a user actually clicks on an advert but of course this happens less often (this metric is known as CTR or ‘Click Through Rate’). eCPM gives you a useful single figure that estimates just how much you can expect to get paid when you have X amount of people using your app for T amount of time.
So what is an average eCPM? Again, this comes down to several factors but just to give you a very rough idea, something in the region of $0.15-$4 could be considered fairly normal for Android banners, while you might make about $2-$10 for interstitials. It’s very hard to find any useful data on this subject though, with these estimates being based on my research trawling forums as well as my own (limited) experience. There’s certainly a lot of variation between developers though.
Likewise, the position of the adverts and nature of the app can also impact on how likely someone is to click it.
So why the variation? It depends on a huge number of factors. For starters, the actual amount advertisers pay for clicks or impressions will vary based on the amount of competition. Advertisers actually bid for ad spaces in an automated manner similar to eBay, meaning that they only have to pay the minimum amount necessary to beat the competition. The more people are competing for a spot on your ad, the higher the PPM and PPC.
Likewise, the position of the adverts and nature of the app can also impact on how likely someone is to click it, which can drive your PPM up or down. Then there are regional differences, with certain markets paying a lot more than others. And finally, sometimes an odd day can throw your statistics way off. If you have a slow day with 5 impressions but they all get clicked and coincidentally have high payouts, then that data will be extrapolated to calculate the average eCPM as being very high. You really need a few thousand impressions before the data is reliable.
But, it suffices to say that some people are earning thousands of dollars per month from AdMob, while a lot of ‘average’ developers are getting peanuts. In short, you need your app to be a pretty big hit in order for AdMob to make you rich. But by removing the price tag for downloading your app, you increase the chance of this happening.
How to set-up AdMob
The good news is that AdMob is easy to try out if you decide you want to give it a go. First, you’ll need to set up an AdMob account. You can do this here and if you already have a Google account, then you can just use that.
Go through the few easy steps and then you’ll be able to get in to the main dashboard. From here, you’ll then be taken through the process of creating your first advert. Simply search for your developer name using the search bar provided and then select the app you wish to try monetizing. If you want to ad an app you haven’t published yet for testing purposes, then you can do this by selecting to add your app manually and then entering the package name. You can then choose if you want to use a banner add, interstitial, rewarded interstitial or native ad.
Depending on what type of ad you choose, you’re now going to be given various options – whether you want to show text only, or images as well, for example. You’ll also be able to name your ad unit, which is simply for your own management and tracking later on.
The refresh rate is important here because it defines how often new ads show, increasing the number of impressions that you can get from a single session. You shouldn’t make this faster than 60 seconds though and note that it can be very distracting if your ad keeps changing!
Next, you can opt to link your app data to Firebase and you should go ahead and do that. This is basically a cloud service that provides more advanced data for AdMob among other things (it also offers features like push notifications and crash reporting). We’ve covered how you can get to know your audience better with Firebase Analytics before and you can watch the useful but cheesy video from Google here. The good news is that if you don’t already have a Firebase account, Google will set one up for you automatically. You can also add a project to Firebase via your Google Analytics account by clicking ‘Get Started With Firebase’ which is found in the top right.
Firebase is optional and at the moment it is still possible to use AdMobs with just the Google Play Services. However, Google is pushing the Firebase option right now, so this is probably the route you should take to ensure you’ll be future-proof. The good news is that the Firebase route is also pretty easy. You’ll need to download the Firebase Config file (Called Google-Services.json) and the link will be shown to you as soon as you’ve selected to use Firebase.
You can then just drop that file into the app directory of your app project. This is important because Android Studio will be looking for it at build. Note that you need to generate unique files for each app you create and you can’t just keep using the same one as they include the package name!
Now you’ll need to load up Android Studio so that you can go to the project level build.gradle file of your app. Here, you’re adding the dependency:
Now head to the app level build.gradle and add a line to apply the plugin:
apply plugin: ‘com.google.gms.google-services’
Then you can simply add the individual services you want as dependencies in that same file. We want to use AdMob in this case and so we use:
Let Gradle do a sync and you should now be all ready to go and start actually adding the ads into your code!
(P.S. What they don’t tell you in the official documentation is that you also need add internet permission to your manifest file, like so: <uses-permission android:name=”android.permission.INTERNET” />. Android studio will prompt you should you forget.)
Inserting your adverts
Once you have the AdMob SDK all set up and ready to go, you can start inserting adverts into your apps. This varies depending on what type of ad you want to use and there’s no point in us repeating what’s in the documentation here, so as an example let’s just look at banner ads.
To begin inserting banner adverts, you’ll first need to create a new string in your Strings.xml. That string is going to provide your ad unit ID so that you can easily change it later.
<string name="banner_ad_unit_id">AD UNIT ID HERE!</string>
You can get this ID from your AdMob dashboard:
At last, you can add the banner in your XML with:
<com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_alignParentBottom="true" ads:adSize="BANNER" ads:adUnitId="@string/banner_ad_unit_id"> </com.google.android.gms.ads.AdView>
Don’t forget to add an extra namespace at the top too:
Finally, you’ll need to insert a couple of lines into your activity’s Java file. First, you need to initialize the SDK at app launch by placing it in onCreate:
MobileAds.initialize(getApplicationContext(), "YOUR APP ID");
Find your app ID by clicking on ‘App management’ which is found in the settings menu of your AdMob control panel.
Finally, you need to load an advert into the AdView you created in your XML. You do this by adding two more lines of code in your onCreate:
AdView mAdView = (AdView) findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); mAdView.loadAd(adRequest);
It sounds like a lot but if you go through each step in sequence, then it’s something you’ll only really need to do once and then you can forget all about it! That said, you can get more technical by tracking your ad lifecycle events such as ‘onAdLoaded’ or ‘onAdClosed’ and you can find details on that here. You’ll set this up with an AdListener but if you’d rather not, it’s entirely optional.
If you recall the Crystalize app we made in a previous tutorial, this is what it should look like with a banner ad added:
So how about Interstitial Ads and Native Ads? These are a little different but thankfully, Google has provided detailed steps for inserting these as well. Check them out here. It’s fairly intuitive once you start understanding the way AdMob works. Plus, it uses the fun tongue-twister ‘instantiate the interstitial’, so you can look forward to that!
Remember that if you’re experimenting and your app isn’t live, then you should use Test Ads rather than regular ads. This is intended to prevent you from accidentally generating your own clicks and thereby risking getting booted off of the platform!
At this point though, you should be ready to start tweaking your placement and settings to see how that effects your profits. It can take a little while to get it all just right but it’s fun experimenting along the way and who knows, it might just lead to a nice little windfall!
When AdMob makes sense
So should you use AdMob? And what kind of app can benefit most from the platform?
The thing to remember here is that user engagement is crucial. If your app is a ‘one time use’ kind of thing, then you just aren’t going to get the impressions, even with hundreds of thousands of downloads. In that case, you’re better of charging per download. On the other hand though, if your app is a highly addictive game that you think users will want to sink a good amount of time into on a daily basis, or if it’s a tool that they’re going to need to use often, then suddenly AdMob makes a lot more sense.
It can take a little while to get it all just right but it’s fun experimenting along the way and who knows, it might just lead to a nice little windfall!
In short, you can make money from paid downloads thanks to the impulsive nature that leads many people to make purchases. But if your app has real staying power, then ultimately that will prove to be a limited business model and AdMob could be making you more.
Of course you also need to bear in mind that users can find ads irritating and that this can harm your user experience. How willing your audience is to put up with this inconvenience is going to depend very much on the type of app and who it is aimed at. But again, this is where experimentation is key – and by trying out different refresh rates, different types of ad, different banner sizes etc., you may just find it’s possible to settle on something that isn’t too in-your-face but still manages to get you a fair amount of impressions and clicks.
Then all that’s left to do is promote the heck out of your app!