Google Ad Manager integration guide
Follow these instructions to set Google Ad Manager live as an ad network on the Unity LevelPlay mediation.
Google Ad Manager ads are served using the AdMob SDK.
Step 1. Create a Google Ad Manager account
- To access Google Ad Manager ad inventory through Unity LevelPlay’s mediation, create an Ad Manager account.
- In order to monetize with Google ad manager, Google AdSense account need to be created
- Connect your AdSense account to your Ad Manager account
Step 2. Create Inventory in Google Ad Manager
- Google AdManager guide can be found here
- Orders:
- Add at least one order
- Connect your AdSense as an Advertiser to the order
- Line Items
- Inside the desired order, Add a Line Item for each ad unit you are looking to monetize (Int / RV / BN / NTV BN)
- Select video Line item
- Line item type = Ad exchange
- Apps
- The application should be added automatically from your Admob account
- If not, create a new application (Inventory > Apps > Add app)
- Ad unit
- Add ad unit for each price point
Step 3. Activate Google Ad Manager in your ironSource account
Sign in to your Google account when setting up Ad Manager on the ironSource SDK Networks Setup page. This will ensure that all of the necessary parameters to run Ad Manager’s interstitials, rewarded videos, and banners will be automatically retrieved.
- In your Google Ad Manager account, obtain the following information:
App ID | The unique ID assigned to your app on the Ad Manager dashboard |
API Key | The unique identifier for your Ad Manager account. This allows the Unity LevelPlay Mediation to import performance data from your Ad Manager account to use in reporting and optimization |
Ad Unit ID | The unique ID assigned to your app’s ad unit on the Ad Manager dashboard |
Client ID | The unique identifier that specifies the relationship between your account and the ad unit |
Client Secret | The secret key that pairs with the Client ID |
Refresh Token | The refresh token the client application already received |
2. Configure Google Ad Manager’s parameters in your ironSource account.
- Log in to your ironSource account and go to ‘Monetize‘ ➣ ‘SETUP‘ ➣ ‘SDK Networks‘.
- Select Google Ad Manager from the list of Available Networks and enter the Ad Manager’s API Key, Client ID, Client Secret, and Refresh Token; or click the Login with Google option.
Login with Google
Click Save. Ad Manager will be enabled and listed in the Available Ad Networks table.
- Select the app on which you’d like to run Unity LevelPlay’s Mediation with Ad Manager.
- Select Ad Manager from the setup list of ad networks and click on the tool Define button. Insert the App ID and Ad Unit ID under interstitial, rewarded video or banner settings.
- Verify your integration with the Reporting API. This column will check your integration through the Reporting API and return three possible responses: Verified, Failed, and No Response. If you do not see Verified, double check your integration and the information you entered, then click Retry until you see Verified.
Step 4. Add the Admob Adapter to Your Build
As of V17.0.0 (Adapter version 4.3.1 onwards), AdMob’s SDK requires publishers to add their AdMob App ID to the app’s AndroidManifest as a child of the <application/>
tag:
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="[ADMOB_APP_ID]"/>
Replace the “[ADMOB_APP_ID]” with the APP ID value you retrieve in step 3.
- Make sure you have the following lines inside allprojects->repositories block
allprojects { repositories { flatDir { dirs 'libs' } google() } }
- Add the following dependency into the dependencies block
dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) }
ironSource SDK supports both Gradle dependencies and manual download mechanisms.
To integrate the Admob Adapter with Gradle:
-
-
- Make sure the following Maven URL exist in your build.gradle script of your app module (should appear only once for all the adapters).
repositories { google() maven { url "https://android-sdk.is.com/" } }
- Add the adapter’s Maven name to your build.gradle script of your app module:
implementation 'com.google.android.gms:play-services-ads:23.6.0' implementation 'com.ironsource.adapters:admobadapter:4.3.48'
- Make sure the following Maven URL exist in your build.gradle script of your app module (should appear only once for all the adapters).
-
To integrate the Admob Adapter through Manual Download:
-
-
- Download the Admob Adapter:
Add the Admob Adapter to your build. You can find the latest Admob Adapter here.
Important! The Admob Adapter Does not contain the Admob SDK. You need to additionally add the Admob SDK directly. - Add the Admob Adapter to your Project:
After you download the Adapter; drop the Admob Adapter jar into the libs folder in your Android Project.
- Make sure you add the following to your Gradle build file under the dependencies section:
implementation 'com.google.android.gms:play-services-ads:23.6.0' implementation 'com.ironsource.adapters:admobadapter:4.3.48'
- Download the Admob Adapter:
-
Step 5. Update AndroidManifest.xml
As of ironSource Android SDK Version 6.17.0 (AdMob Android adapter version 4.3.10+), AdMob adapter will be released as AAR. Only if you intend to keep your Jar integration, please add the manifest.
Manifest Permissions:
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Manifest Activities:
Add the following activities inside the <application> tag on your manifestAdditions:
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent" />
As of V17.0.0 (Adapter version 4.3.1 onwards), AdMob’s SDK requires publishers to add their AdMob App ID to the app’s AndroidManifest as a child of the <application></application>
tag:
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="[ADMOB_APP_ID]"/>
Replace the “[ADMOB_APP_ID]” with the APP ID value you retrieved in step 3.
Not doing so results in crashes originated with AdMob’s SDK. For more information please refer to AdMob’s guide.
Step 6. Additional Steps
Child-directed setting – COPPA
Unity LevelPlay’s mediation lets publishers communicate AdMob Child-directed settings directly to the AdMob network.
This feature is enabled using ironSource SDK 6.14.0+, AdMob Android Adapter 4.3.9+.
Use the following syntax, to set AdMob setTagForChildDirectedTreatment with the parameter TAG_FOR_CHILD_DIRECTED_TREATMENT_TRUE:
IronSource.setMetaData("AdMob_TFCD","true");
Use the following syntax, to set AdMob setTagForChildDirectedTreatment with the parameter TAG_FOR_CHILD_DIRECTED_TREATMENT_FALSE:
IronSource.setMetaData("AdMob_TFCD","false");
To learn more about Child-directed settings Under AdMob network visit here.
Users under the age of consent – GDPR
Unity LevelPlay’s mediation lets publishers communicate with AdMob network, a Tag For Users under the Age of Consent in Europe (TFUA) request.
This feature is enabled using ironSource SDK 6.14.0+, AdMob Android Adapter 4.3.9+.
Use the following syntax, to set setTagForUnderAgeOfConsent with TAG_FOR_UNDER_AGE_OF_CONSENT_TRUE:
IronSource.setMetaData("AdMob_TFUA","true");
Use the following syntax, to set setTagForUnderAgeOfConsent with TAG_FOR_UNDER_AGE_OF_CONSENT_FALSE:
IronSource.setMetaData("AdMob_TFUA","false");
To learn more about Child-directed settings Under AdMob network visit here.
Ad Content filtering
Unity LevelPlay’s mediation lets publishers communicate with AdMob network, maximum ad content rating for all ad requests.
This feature is enabled using ironSource SDK 7.12.0+, AdMob Android Adapter 4.3.23+.
Use the following syntax, to set maxAdContentRating:
IronSource.setMetaData("AdMob_MaxContentRating","MAX_AD_CONTENT_RATING_G");
The possible values for this property are based on digital content label classification as defined by Google:
- MAX_AD_CONTENT_RATING_G
- MAX_AD_CONTENT_RATING_PG
- MAX_AD_CONTENT_RATING_T
- MAX_AD_CONTENT_RATING_MA
To learn more about Ad Content Rating property Under AdMob network visit here.
Content URL mapping support
Unity LevelPlay supports Google’s content mapping for apps, and allows you to share URLs using “Google_Content_Mapping” settings. This feature is enabled using ironSource SDK 7.7.0+, AdMob Adapter 4.3.41+. Learn more about Google’s content mapping here.
To pass a single-content URL, use the following syntax:
IronSource.setMetaData("Google_Content_Mapping ","https://www.example.com");
To support multiple urls, use the same key and share up to 4 URLs:
IronSource.setMetaData("Google_Content_Mapping",["https://www.expamle1.com","https://www.example2.com"]);
Verify Your Ad Network Integration
The ironSource SDK provides an easy way to verify that your mediation integration was completed successfully. To verify your ironSource SDK and additional Ad Networks’ integration, follow this document.
Done!
You are now all set to deliver Google Ad Manager within your application!
What’s Next?
To leverage additional mediation ad networks, integrate the adapters and follow our integration guides.