AdMob Adapter

1280px-Google_AdMob_logo.svg.png

This guide is directed to Publishers interested in integrating the StartApp Android SDK using AdMob as the mediating network.

NOTES:
  • The code samples in this document can be copy/pasted into your source code
  • Feel free to take a look at our Sample Project to help you during the integration process.
  • If you have any questions, contact us via support@startapp.com

Assumptions:

AdMob is set as your mediation network

The following manual assumes you are already familiar with the AdMob Mediation Network and have already integrated the Google Mobile Ads SDK into your application with at least one Ad Unit. Otherwise, please start by reading the following articles for a walk-through explanation of what mediation is, how to use the AdMob Mediation UI, and instructions on how to add AdMob mediation code into your app.

You application is defined in your StartApp Account

At this point we assume that you have already added your application to your StartApp account, in case you haven't, please follow the following steps:

  1. Login into your StartApp Publisher's account
  2. Add your application and get its App ID
  3. Download the StartApp In-App SDK

For any questions or difficulties during this process, please contact us via support@startapp.com

You have integrated the StartApp In-App SDK V.4.5.0 as well as your desired Ad Formats.

Before you can integrate the mediation adapter, you need to make sure you have integrated the StartApp SDK V.4.5.0 as well as the Ad Formats you wish to monetize. 

In case you haven't, please start from the steps described on the following SDK integration guide

NOTES:
  • Note that this AdMob adapter is only comptible from StartApp SDK V.4.5.0

Step 1, Integrating the AdMob Mediation Adapter

You can add the AdMob adapter via Gradle jCenter dependency 

dependencies{ 
implementation 'com.startapp:inapp-sdk:4.5.0'
implementation 'com.startapp:admob-mediation:2.0.0'
}


Another option to integrate the Adapter is through .java files:

StartApps AdMob Adapter is also available on Open Source from GitHub, enabling you download the StartappAdapter.java file and debug issues in case you would like to do so. 

For this method, please download the file and add it to your project and change the package path at the top of this file (from: com.startapp.mediation.admob to your own path).

NOTES:
  • Please use only one of the options mentioned above 

Step 2, Configure Mediation Settings

Please log in to your AdMob account in order to add StartApp to the mediation configuration. 

In case you have an existing mediation group to which you would like to add StartApp to, you can go ahead and do so. Otherwise, please follow the following steps to create a new mediation  group.

  1.  Click on the "Mediation" link on the side bar menu 

    AdMob_Mediation.png

  2. Select "CREATE MEDIATION GROUP" 

    CREATE_MEDIATION_GROUP.png

  3. Select the Ad Format you are looking to begin with and "Android as your platform"

    New_Mediation_Group_settings.png
  4. Please Name your mediation Group and Select the relevant Ad Units (existing from previous configuration in your App).

Step 3, Add Custom Event 

In your Mediation Group go ahead to define the relevant custom event. 

Add_custom_event.png

 

Please select the Label Name as: StartApp 

Define the eCPM as expected from the StartApp Network. (note that this will impact the level of the Waterfall in which the StartApp SDK will be called)

Step 4, Configure StartApp Ad Units

On the next screen: "Map ad units: StartApp" please define the following Class Name:
 com.startapp.mediation.admob.StartappAdapter

CustomEvent_Sample.png

Step 5, AdMob Ad Unit advanced Configuration

There are several parameters for each Ad Unit which can be configured from the AdMob Portal or from the code. 

All the parameters mentioned below are optional and should be set based on your monetization strategy and criteria.

NOTES:
  • Everything defined from the AdMob Portal will override the parallel configuration made through the code.
  • All configurable parameters must be set in Json format and under the relevant custom event class, note that you can choose to configure non to any of the available parameters.

Interstitial Settings: 

Through the AdMob Portal:

{adTag:'interstitialTagFromServer', interstitialMode:'OVERLAY', minCPM:0.02, muteVideo:false}  

Through the code:

final Bundle extras = new StartappAdapter.Extras.Builder()
	.setAdTag("interstitialTagFromAdRequest")
	.setInterstitialMode(StartappAdapter.Mode.OFFERWALL) // can be VIDEO and OVERLAY as well
	.muteVideo()
	.setMinCPM(0.01)
	.toBundle();
  
interstitial.loadAd(new AdRequest.Builder()
   .addCustomEventExtrasBundle(StartappAdapter.class, extras)
   .build());  

Banner Settings: 

Through the AdMob Portal:

{adTag:'bannerTagFromServer', minCPM:0.02, is3DBanner:false} 

Through the code:

final Bundle extras = new StartappAdapter.Extras.Builder()
	.setAdTag("bannerTagFromAdRequest")
	.enable3DBanner()
	.setMinCPM(0.01)
	.toBundle();

banner.loadAd(new AdRequest.Builder()
	.addCustomEventExtrasBundle(StartappAdapter.class, extras)
	.build()); 

Rewarded Video Settings: 

Through the AdMob Portal:

{adTag:'rewardedTagFromServer', minCPM:0.02, muteVideo:false} 

Through the code:

final Bundle extras = new StartappAdapter.Extras.Builder()
	.setAdTag("rewardedTagFromAdRequest")
	.muteVideo()
	.setMinCPM(0.01)
	.toBundle();

rewarded.loadAd(new AdRequest.Builder()
	.addNetworkExtrasBundle(StartappAdapter.class, extras)
	.build(), loadCallback);

Native Settings: 

Available sizes are:
SIZE72X72, SIZE100X100, SIZE150X150, SIZE340X340, SIZE1200X628, SIZE320X480, SIZE480X320

NOTES:
  • The code sample below uses a specific AdSize as a sample,  you can replace the sizes on the sample code with any of the supported AdSizes by StartApp

Through the AdMob Portal :

{adTag:'nativeTagFromServer', minCPM:0.02, nativeImageSize:'SIZE150X150', nativeSecondaryImageSize:'SIZE340X340'}

Through the code:

final Bundle extras = new StartappAdapter.Extras.Builder()
	.setAdTag("nativeTagFromAdRequest")
	.setMinCPM(0.01)
	.setNativeImageSize(StartappAdapter.Size.SIZE72X72)
	.setNativeSecondaryImageSize(StartappAdapter.Size.SIZE150X150)
	.toBundle();

loader.loadAd(new AdRequest.Builder()
    .addCustomEventExtrasBundle(StartappAdapter.class, extras)
    .build());

 

Congratulation - that's it! You may now run your app and see StartApp ads in action.

 

 

Was this article helpful?
2 out of 4 found this helpful