You have created Great App, now you want to make money from it. If you don't want to charge your customer, Then the best way to monetize your app is using the Ad Network.
And Admob is one of the best Ad Networks available.
Basically, Admob provides 4 types of ad,
3. Rewarded Interstitial
In this tutorial, we will cover Banner Ad and Interstitial Ad.
The banner ad will be the small banner that will display on your mobile app screen at the place you want, And on click of Banner, it will display the Ad overlay. You can set the time interval for the add and get the user interaction event for the Banner
When in Interstitial Ad, It will display full screen when your app invokes it. Because of their larger size, interstitial ads require more bandwidth on average than traditional banners. So its recommended approach is to have apps load them in advance of when they will be displayed. This helps ensure that an ad is ready to go when the time comes to display one.
So that being said, We have to start Admob integration with creating an account for Admob, and add the first app to monetize.
Steps To Monetize The App
Open the Google Admob website and click on Sign in. If you don't have an account then click on Sign Up and then create a new account.
Once you are logged in click on the Monetize tab in the top bar then click on the MONETIZE NEW APP.
At this point, Admob will collect multiple information from you to create the App Monetization and provide the SDK for the app. The first thing you have to do is provide information regarding your application, Like App name, and Platform. You can also search the app if it's already uploaded, or you can select from the app you have already added to the system.
The next thing in the line will be to select the type of Ad we want to create And provide a name for the Ad.
Also, you need to select which type of content you want to show in the Ad Banner,
For this tutorial, we select both and select Refresh Rate for the Ad. Setting a small Refresh Rate will display multiple Ads, but use more network bandwidth.
You can also select different Text ad types, for this tutorial we are selecting STANDARD.
Admob will display how your Ad will display in the app, So in this step, you can check the look and feel of your Ad.
Once you completed Step 4 AdMob will provide you AD UNIT ID, Save this for later use in-app.
Next step will be to add FIREBASE ANALYTICS in-app, Firebase analytics help you display the different kinds of analytics and report on sessions, user demographics, revenue from in-app products, and a lot more will appear in the Firebase console, with no extra code required.
But in this tutorial, we are not adding Firebase Analytics so we can skip this.
This is optional Step, If you want to add only Banner Ad in your app then skip step 7 and 8,
But in this tutorial we will also add INTERSTITIAL Ad in app, so we will follow step 1 to 3 again and select Interstitial this time.
In Interstitial Ad we have three type of Ad
For this tutorial, we will select all the types, but you can select the option you need.
Select the Capping and provide the Ad unit name.
Admob will display the Ad unit ID, copy this for later use in App.
So now we have an Admob Account setup, and our app is added for Monetizing.
We have Ad unit ID and Google Admob SDK, So the next step will be to integrate Admob SDK in-app and provide Ad Unit ID to display the Ad.
For easy implementation of Google Admob, you can use the MTGoogleAdMob library,
Download the code from Github.
Step To Include Admob SDK In App
Create a new project using the Xcode.
You have GoogleMobileAds.framework by following the above step, and you can find GoogleAdsMob.Swift file from the Github code, This is the Handler created to handle all Admob-related task in your app. So drag and drop both these files in your project.
Now add two buttons in your ViewController class, displayed as below image,
And Connect its Outlet and Methods.
Now on GoogleAdsMob.swift page, you need to provide your Ads Unit ID for Banner Ad and Interstitial Ad.
Admob provides two-mode,
1. Test Mode
2. Live Mode
When your app is still under development then you must use the test Ads Unit ID, As otherwise, the click generated on the Live Admob Unit ID will create an issue with Admob Monetization. And your account can be suspended, so only use Live Ads Unit ID when you upload your app to App Store or Play Store.
The next step will be Initialization, Initialize the Google Admob in your AppDelegate file in Method DidFinishLaunchingWithOptions.
Add the following code in your App Button’s Method
?Show Interstitial Ads
?Show Banner Ads
?Hide Banner Ads
Now run the app and you will see the following screen in your simulator,
If you have selected the Test Mode and you click on each button you will see Ads as follow,
It will display the Test Banner and Interstitial Ads
And if you add Live Ads Unit ID in your code then it will display actual ads,
The next step will be to check other Ads and integrate it, you can check more about it on the Admob documentation.