Skip to content

Advanced Settings

Ad Placements

You can set a placement name for each ad unit (for example, “Rewarded VideoLevels”, “INTER_levelEnd”, or “RewardedVideoCoinStore”). This can help you aggregate statistics for different placement categories. The following snippets show you how to set the placement name for various ad formats.

Banners / MRECs

adView.setPlacement( "«placement»" );
adView.loadAd();

Interstitials

interstitial.showAd( "«placement»" );

Rewarded Ads

rewardedAd.showAd( "«placement»" );

Native Ads

nativeAdLoader.setPlacement( "«placement»" );

Native Ads (Ad Placer)

MaxAdPlacerSettings settings = new MaxAdPlacerSettings( "«ad-unit-ID»" );
settings.setPlacement( "«placement»" );

Mute Audio

You can mute audio for some mediated SDK networks when you launch your app. The networks that support this functionality via the AppLovin SDK are Google bidding and Google AdMob, AppLovin, DT Exchange, Google Ad Manager, LINE, Mintegral, Tencent, and Verve. For other networks, consult your network’s account team to learn whether this functionality is available and how to access it.

The following code snippets show how you mute audio on those networks that support this feature:

AppLovinSdk sdk = AppLovinSdk.getInstance( context );
sdk.getSettings().setMuted( true ); // to mute
sdk.getSettings().setMuted( false ); // to unmute

Enable Verbose Logging

Enable verbose logs by setting a boolean flag in the settings object of the SDK:

Programmatically

AppLovinSdk.getInstance( context ).getSettings().setVerboseLogging( true );

Android Manifest

You can also enable verbose logging by editing your application’s Android Manifest file. Add a <meta-data> element like the following:

<application>
<meta-data android:name="applovin.sdk.verbose_logging" android:value="true" />
</application>

Verification

To verify that you enabled verbose logs successfully, check for the line that reads Verbose Logging On: true in the initialization section of the AppLovin SDK logs:

AppLovin SDK
Version: 11.4.2
Verbose Logging On: true

AppLovin SDK tags its logs with the tag “/AppLovinSdk: [AppLovinSdk]”.

Creative ID and Network Name

You can retrieve the creative ID and the network name of displayed ads from various mediated networks. Refer to the Creative Debugger documentation for more information.

DSP Name

To retrieve the name of the DSP for a MAX ad served from AppLovin Exchange, call the ad’s getDspName() method:

@Override
public void onAdLoaded(final MaxAd ad)
{
System.out.println( "AppLovin Exchange DSP name: " + ad.getDspName() );
}

Impression-Level User Revenue API

Starting in SDK version 10.3.0, you can access impression-level user revenue data on the client side. You can use this data to compare different sources and campaigns. You can also access this data by using the MAX User Revenue API. MMPs who want to access this data should review the Impression-Level User Revenue API for MMPs documentation.

You can share impression-level ad revenue data with your mobile measurement partner of choice, such as Adjust for all supported networks.

You can retrieve the revenue amount in all ad lifecycle callbacks. Do this by creating a MaxAdRevenueListener, implementing its onAdRevenuePaid() method, and passing that listener to setRevenueListener(). The following example shows how to implement such an “ad revenue paid” callback:

@Override
void onAdRevenuePaid(final MaxAd ad)
{
double revenue = ad.getRevenue(); // In USD
// Miscellaneous data
String countryCode = AppLovinSdk.getInstance( context ).getConfiguration().getCountryCode(); // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD"
String networkName = ad.getNetworkName(); // Display name of the network that showed the ad
String adUnitId = ad.getAdUnitId(); // The MAX Ad Unit ID
MaxAdFormat adFormat = ad.getFormat(); // The ad format of the ad (e.g. BANNER, MREC, INTERSTITIAL, REWARDED)
String placement = ad.getPlacement(); // The placement this ad's postbacks are tied to
String networkPlacement = ad.getNetworkPlacement(); // The placement ID from the network that showed the ad
}

You can also retrieve a precision evaluation for the revenue value, as shown in the following example:

String revenuePrecision = ad.getRevenuePrecision();

This precision takes one of the following values:

"publisher_defined"
the revenue amount is the price assigned by the publisher
"exact"
the revenue amount is the result of a real-time auction
"estimated"
the revenue amount is based on Auto-CPM or FB Bidding estimates
"undefined"
no revenue amount is defined and there is not enough data to estimate
""
revenue and precision are not valid (for example, in test mode)

Establishing Ad Request Callbacks

To listen for when an ad request is made, set a MaxAdRequestListener, implement its onAdRequestStarted() method, and pass that listener to setRequestListener(). The following example shows how to implement such an “ad request started” callback:

@Override
public void onAdRequestStarted(final String adUnitId)
{
// Ad request started here
}

Selective Init

You can initialize the SDK with specific ad units. If you do so, the SDK only initializes those networks that you have configured for the ad units you specify. If you do not specify any ad units, the SDK assumes the current session needs all of your ad units. In such a case it initializes all networks that you have configured for those ad units. The following example shows how you implement this feature:

AppLovinSdkSettings settings = new AppLovinSdkSettings( context );
List<String> adUnitIds = new ArrayList<>();
adUnitIds.add( "«ad-unit-ID-1»" );
adUnitIds.add( "«ad-unit-ID-2»" );
settings.setInitializationAdUnitIds( adUnitIds );
AppLovinSdk sdk = AppLovinSdk.getInstance( settings, context );
sdk.setMediationProvider( "max" );
sdk.initializeSdk( new AppLovinSdk.SdkInitializationListener() {
@Override
public void onSdkInitialized(final AppLovinSdkConfiguration config) {
}
} );

Waterfall Information API

The Waterfall Information API tells you about the current waterfall for an ad (one that has loaded or failed to load). The API returns the ad load state, latency, credentials, and mediated network information for each ad in the waterfall. If an ad in the waterfall fails to load, the API provides error information.

This API is supported as of Android SDK version 10.3.5.

AdLoadState Values

valueexplanation
0Ad Load Not Attempted
1Ad Loaded
2Ad Failed To Load

Example

@Override
public void onAdLoaded(final MaxAd ad)
{
MaxAdWaterfallInfo waterfall = ad.getWaterfall();
if ( waterfall == null ) return;
System.out.println( "Waterfall Name: " + waterfall.getName() + " and Test Name: " + waterfall.getTestName() );
System.out.println( "Waterfall latency was: " + waterfall.getLatencyMillis() + " milliseconds" );
String waterfallInfoStr;
for ( MaxNetworkResponseInfo networkResponse : waterfall.getNetworkResponses() )
{
waterfallInfoStr = "Network -> " + networkResponse.getMediatedNetwork() +
"\n...adLoadState: " + networkResponse.getAdLoadState() +
"\n...latency: " + networkResponse.getLatencyMillis() + " milliseconds" +
"\n...credentials: " + networkResponse.getCredentials();
if ( networkResponse.getError() != null )
{
waterfallInfoStr += "\n...error: " + networkResponse.getError();
}
System.out.println( waterfallInfoStr );
}
}
@Override
public void onAdLoadFailed(final String adUnitId, final MaxError error)
{
MaxAdWaterfallInfo waterfall = error.getWaterfall();
if ( waterfall == null ) return;
System.out.println( "Waterfall Name: " + waterfall.getName() + " and Test Name: " + waterfall.getTestName() );
System.out.println( "Waterfall latency was: " + waterfall.getLatencyMillis() + " milliseconds" );
for ( MaxNetworkResponseInfo networkResponse : waterfall.getNetworkResponses() )
{
System.out.println( "Network -> " + networkResponse.getMediatedNetwork() +
"...latency: " + networkResponse.getLatencyMillis() +
"...credentials: " + networkResponse.getCredentials() + " milliseconds" +
"...error: " + networkResponse.getError() );
}
}

Customize Banner / MREC Ad Refresh

You can customize banner and MREC ad refresh intervals via the API, just as you can configure them in the Ad Unit UI. The minimum and maximum refresh intervals allowed are 10 seconds and 120 seconds, respectively. Values outside of these limits are ignored. The following code samples show you how to customize these refresh intervals:

// Where adView is an instance of MaxAdView
adView.setExtraParameter( "ad_refresh_seconds", «ad-refresh-rate» );