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. Below are code snippets that show how you set the placement name for various ad formats:

  • AppLovinMAX.createBanner(ad_unit_id, position);
    AppLovinMAX.setBannerPlacement(ad_unit_id, placement);
  • <AppLovinMAX.AdView adUnitId={ad_unit_id}
                        adFormat={AppLovinMAX.AdFormat.BANNER}
                        placement={placement} />
  • AppLovinMAX.createMRec(ad_unit_id, position);
    AppLovinMAX.setMRecPlacement(ad_unit_id, placement);
  • <AppLovinMAX.AdView adUnitId={ad_unit_id}
                        adFormat={AppLovinMAX.AdFormat.MREC}
                        placement={placement} />
  • AppLovinMAX.showInterstitial(ad_unit_id, placement);
  • AppLovinMAX.showRewardedAd(ad_unit_id, placement);

Mute Audio

You can mute audio for certain 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 snippet shows how you mute audio on the supported networks:

AppLovinMAX.setMuted(true);  // to mute
AppLovinMAX.setMuted(false); // to unmute

Enable Verbose Logging

Enable verbose logs with the following call:

AppLovinMAX.setVerboseLogging(true);

To verify that you enabled verbose logs successfully you can 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 of various mediated networks. Refer to the Creative Debugger documentation for more information.

DSP Name

You can retrieve the name of the DSP for a MAX ad served from AppLovin Exchange via the ad’s dspName property:

AppLovinMAX.addInterstitialLoadedEventListener((adInfo) => {
  console.log("AppLovin Exchange DSP Name: " + adInfo.dspName);
}

Impression-Level User Revenue API

Starting in React Native Plugin 3.1.1, 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.

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. The following example shows how to do this within the “ad revenue paid” callback:

AppLovinMAX.addInterstitialAdRevenuePaidListener((adInfo) => {…});
AppLovinMAX.addRewardedAdRevenuePaidListener((adInfo) => {…});
AppLovinMAX.addBannerAdRevenuePaidListener((adInfo) => {…});
AppLovinMAX.addMRecAdRevenuePaidListener((adInfo) => {…});
AppLovinMAX.addAppOpenAdRevenuePaidListener((adInfo) => {…});

AppLovinMAX.addInterstitialAdRevenuePaidListener((adInfo) => {
  const revenue = adInfo.revenue;
  // Miscellaneous data
  const countryCode = adInfo.countryCode; // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD"
  const networkName = adInfo.networkName; // Display name of the network that showed the ad (e.g. "AdColony")
  const adUnitId = adInfo.adUnitId; // The MAX Ad Unit ID
  const placement = adInfo.placement; // The placement this ad's postbacks are tied to
  const networkPlacement = adInfo.networkPlacement; // The placement ID from the network that showed the ad
});

Waterfall Information API

This feature allows you to see the information about the current waterfall for an ad that has loaded or failed to load. The network responses provide 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 network response provides error information. This API is supported as of React Native plugin version 3.1.1.

AdLoadState Values
0 Ad Load Not Attempted
1 Ad Loaded
2 Ad Failed To Load

Example

AppLovinMAX.addInterstitialLoadedEventListener((adInfo) => {
  console.log('Waterfall Name: ' + adInfo.waterfall.name + ' and Test Name: ' + adInfo.waterfall.testName);
  console.log('Waterfall latency was: ' + adInfo.waterfall.latencyMillis + ' milliseconds');

  adInfo.waterfall.networkResponses.forEach(networkResponse => {
    console.log('Network name:' + networkResponse.mediatedNetwork.name +
                ' adapterClassName:'+ networkResponse.mediatedNetwork.adapterClassName +
                ' sdkVersion:' + networkResponse.sdkVersion +
                ' adapterVersion:' + networkResponse.adapterVersion);
    console.log('...adLoadState:' + networkResponse.adLoadState);
    console.log('...latency:' + networkResponse.latencyMillis);
    console.log('...credentials:' + networkResponse.credentials.placement_id);
  });
});

AppLovinMAX.addInterstitialLoadFailedEventListener((errorInfo) => {
  console.log('Waterfall Name: ' + errorInfo.waterfall.name + ' and Test Name: ' + errorInfo.waterfall.testName);
  console.log('Waterfall latency was: ' + errorInfo.waterfall.latencyMillis + ' milliseconds');

  errorInfo.waterfall.networkResponses.forEach(networkResponse => {
    console.log('Network name:' + networkResponse.mediatedNetwork.name +
                ' adapterClassName:'+ networkResponse.mediatedNetwork.adapterClassName +
                ' sdkVersion:' + networkResponse.sdkVersion +
                ' adapterVersion:' + networkResponse.adapterVersion);
    console.log('...latency:' + networkResponse.latencyMillis);
    console.log('...credentials:' + networkResponse.credentials.placement_id);
    console.log('...error code:' + networkResponse.error.code + ' message:' + networkResponse.error.message);
  });
});

Output

Waterfall Name: Default Waterfall and Test Name: Control
Waterfall latency was: 2793 milliseconds
Network adapterClassName:com.applovin.mediation.adapters.UnityAdsMediationAdapter name:Unity Ads sdkVersion:4.2.1.0 adapterVersion:4.2.1
...adLoadState:2
...latency:25
...credentials placement_id:BN_0_9
...error code:-5212 message:WebView Error
Network adapterClassName:com.applovin.mediation.adapters.LineMediationAdapter name:LINE Ads sdkVersion:2.4.20211029 adapterVersion:2021.10.29.2
...adLoadState:2
...latency:275
...credentials placement_id:872167
...error code:-5205 message:Ad Not Ready
Network adapterClassName:com.applovin.mediation.adapters.ByteDanceMediationAdapter name:Pangle sdkVersion:4.3.0.9 adapterVersion:4.3.0.9
...adLoadState:1
...latency:337
...credentials placement_id:980034018