May 10 2018Written by Manektech Team
You have created Great App, now you want to make money from it. But 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 Network available.
Basically, Admob provide 4 types of ad,
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 been said, We have to start Admob integration with creating an account for Admob, and add the first app to monetize.
Open the Google Admob website and click on Sign in. If you don't have account then click on Sign Up and then create new account.
Once you are logged in click on the Monetize tab in top bar then click on the MONETIZE NEW APP.
At this point Admob will collect multiple information from you to create the App Monetizationand provide the SDK for the app.First thing you have to do is provide information regarding your application, Like App name, Platform. You can also search the app if it's already uploaded, or you can select from the app you have already added in the system.
Next thing in the line will be to select the type of Ad we want to create, And provide name for the Ad.
Also you need to select the 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 small Refresh Rate will display multiple Ad, but use more network bandwidth.
You can also select different Text ad type, 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 the Step 4 admob will provide you AD UNIT ID, Save this for later us in app.
Next step will be to add FIREBASE ANALYTICS in app, Firebase analytics help you display the different kind of analytic 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 type, but you can select the option you need.
Select the Capping and provide Ad unit name.
Admob will display the Ad unit ID, copy this for later use in App.
So now we have 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 MTGoogleAdMob library,
Download the code from the Github.
Create 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 this file in your project.
Now add two button in your ViewController class, displayed as below image,
And Connect its Outlet and Methods.
Now in GoogleAdsMob.swift page you need to provide your Ads Unit ID for Banner Ad and Interstitial Ad.
Admob provide two mode,
When your app is still under development then you must use test Ads Unit ID, As otherwise the click generated on the Live Admob Unit ID will create issue with Admob Monetization. And your account can be suspended, so only use Live Ads Unit ID when you upload your app on App Store or Play Store.
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,
Next step will be to check other Ads and integrate it, you can check more about it on the Admob documentation.
Feel free to ask any concern regarding Admob, kindly Contact Us to learn more about it.
Some text in the modal.