Add AdMob App
In order to avoid your AdMob account being judged as Invalid traffic during the test, we strongly recommend that you use the test ID provided by AdMob to configure the following before the app is on the app store. After passing the test, change the parameters.
For test mode operation guidelines, please refer to AdMob Test Mode.
1. Click Apps → ADD YOUR FIRST APP.
If you already have other apps under your AdMob account, please click Apps → ADD APP in the left navigation bar.
2. Select your corresponding platform. If your app is not yet available in the app store, please select No.
3. If your app is already available, please enter the app store URL, select your app below and click SEARCH.
4. After creation, you will get the App ID.
AdMob Ad Unit ID
1. Click Apps → Select your app → Ad units → GET STARTED.
2. Select and create the corresponding ad unit.
-
Banner
-
Interstitial
-
Rewarded
-
Native advanced
3. After the creation is complete, you will get the Ad unit ID, which will be used in the OpenMediation configuration later.
The meaning of each field in the Ad unit
Field | Description and Suggestions |
---|---|
Ad unit name |
Enter a unique name and description that will help you find this ad unit later. we recommend that you name it: Placement ID_Ad Network Name_ Country_Floor Price |
Ad type |
Choose the ad type(s) allowed for this ad unit. You can choose any combination.
The ad types available depend on the ad format you select. |
Automatic refresh |
Determines how often a new ad request is generated for this ad unit and a new ad is shown to the user. Recommended: Google optimized. Google optimized: Calculated using AdMob historical data. Learn more. Custom: You can set it to refresh once within 30-150 seconds. Disabled: It means there is no restriction on the refresh frequency. |
eCPM floor |
Define the minimum eCPM that the AdMob Network needs to meet to serve an ad. Note: Setting a high eCPM floor may cause a decrease in overall fill rate. |
Frequency capping |
Limits the number of times ads are shown to the same person per minute, per hour, or per day. Learn more |
Server-side verification |
Adds an additional layer of validation when a user finishes viewing a video ad in addition to standard client-side callbacks. Note: Post back may take a few minutes after it's triggered. |
OpenMediation Platform Configuration
Ad Network
1. Enter the OpenMediation publisher platform, click on Ad Network → click Edit behind Google AdMob.
2. After filling in the relevant information, click Save.
- App ID:You can get your App ID in AdMob background Apps → App settings.
-
Currency: Select the corresponding currency unit in your AdMob reporting module.
You can click Sign in with Google to pull API data for Google login authorization (if you already have other apps under your account that have completed this step, you can directly select the corresponding Publisher ID).
You can also choose Manual to manually configure API data pull parameters (if you have logged in and authorized, you do not need to perform the following operations).
Enter the Google Console Platform and log in to your Google account. If you log in to the Google Information Center for the first time, please select the country or region where your AdMob account is located.
- API Key:
- Click Select Project → NEW PROJECT.
- The Project name and Location can use the default name and location, and can also be customized.
- In the Getting Started section below, click Explore and enable APIs.
- Click Credentials → CREATE CREDENTIALS → API Key.
- Get your API Key, and fill in the OpenMediation platform.
- Client ID & Client Secret:
- In the search box above, search for AdMob API, and then click ENABLE.
- Click on the navigation menu in the upper left corner and select API and Services → OAuth consent screen.
- Select External and click CREATE.
- Save after entering the application name (no need to fill in other fields).
- Enter the credential interface, click Create credential → OAuth client ID.
- Select Web Application for application type, and add https://developers.google.com/oauthplayground redirect URI, click CREATE.
- Obtain the Client ID and Client Secret, and fill in the OpenMediation platform.
- Refresh Token:
- Enter OAuth 2.0 Playground, click the settings button on the right, check Use your own OAuth credentials, and enter your Client ID and Client Secret.
- In Step 1, select AdMob APIv1→
https://www.googleapis.com/auth/admob.report, and click Authorize APIs. - Log in to your account and authorize the project.
- Click Exchange authorization code for tokens, get Refresh Token, and fill in OpenMediation platform.
Add Instance
1.Click Mediation → Ad unit → Add Instance.
2. After filling in the relevant information, click Save.
-
Ad Netwrok: Select AdMob.
-
Instance Name: You can define the name of your ad unit yourself, we suggest you name it: Placement ID_Ad Network Name_ Country_Floor Price. (E.g: 6539_AdMob_USA_40)
-
Unit ID:You can enter the AdMob backend, enter the Ad units in the left navigation bar, find the AdMob Unit ID on the right side of the interface, and paste it into the OpenMediation platform.
AdMob Test Mode
It’s important to enable test ads so that you can click on ads without charging Google advertisers. If you click on too many ads in non-test mode, your account may be reported for violating AdMob’s Invalid traffic policy.
Learn more, AdMob test ads for Android and AdMob test ads for iOS.
Configure the following AdMob test Unit ID on the OpenMediation platform.
- AdMob Unit ID
Android-AdMob Unit ID for Test
Ad format | AdMob Unit ID for Test |
---|---|
Rewarded Video | ca-app-pub-3940256099942544/5224354917 |
Interstitial | ca-app-pub-3940256099942544/1033173712 |
Native Advanced | ca-app-pub-3940256099942544/2247696110 |
Banner | ca-app-pub-3940256099942544/6300978111 |
iOS-AdMob Unit ID for Test
Ad format | AdMob Unit ID for Test |
---|---|
Rewarded Video | ca-app-pub-3940256099942544/1712485313 |
Interstitial | ca-app-pub-3940256099942544/4411468910 |
Native Advanced | ca-app-pub-3940256099942544/3986624511 |
Banner | ca-app-pub-3940256099942544/2934735716 |
Add the AdMob SDK&Adapter to Your Build
Android
1. Add the AdMob SDK
- Add the following in your application-level build.gradle file inside dependencies section.
implementation 'com.google.android.gms:play-services-ads:+'
2. Add AdMob Adapter
OpenMediation supports both Gradle dependencies and Manual download mechanisms.
Gradle dependencies
- Add the following in your application-level build.gradle file inside dependencies section.
implementation 'com.openmediation.adapters:admob:+'
Manual download
- Download the AdMob Adapter from here.
- Add the AdMob Adapter to Your Project.
3. Update Android Manifest.xml
- Configure Android Manifest.xml
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="admob_app_id" />
4. For Proguard Users Only
If you are using ProGuard with the AdMob adapter, you must add the following code to your ProGuard configuration (Android Studio: proguard-rules.pro or Eclipse: proguard-project.txt):
-keep public class com.google.android.gms.** {
public *;
}
-keep public class com.google.ads.** {
public *;
}
iOS
OpenMediation supports both Cocoapods and Manualdownload mechanisms.
Cocoapods
To Integrate the AdMob SDK with Cocoapods, enter the following line in your podfile and you are good to go!
pod 'Google-Mobile-Ads-SDK'
Manual Download
1. Download the AdMob framework
- you can find the lastest AdMob SDK here.
2. Add the AdMob frameworks to your Project
Update Info.plist
If you have added AdMob SDK in your project, you need to update your application Info.plist file, add string value your AdMob application ID GADApplicationIdentifier key. You can find your app ID in the AdMob interface.
Please Note: Be sure to use your actual AdMob app ID instead of the ID listed above .
Importrant! This step is required since the Google Mobile Ads SDK version 7.42.0. Failure to add this Info.plist entry will result in a crash with the following message: "The Google Mobile Ads SDK was initialized incorrectly."
Done!
You are now all set to deliver AdMob Ads within your application.
Comments
Article is closed for comments.