跳转到内容

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.

AppLovinMAX.createBanner(«ad-unit-ID», «position»);
AppLovinMAX.setBannerPlacement(«ad-unit-ID», «placement»);

Interstitial Ads

import { InterstitialAd } from 'react-native-applovin-max';
InterstitialAd.showAd(«ad-unit-ID», «placement»);

Rewarded Ads

import { RewardedAd } from 'react-native-applovin-max';
RewardedAd.showAd(«ad-unit-ID», «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:

AppLovinMAX.setMuted(true);

Enable Verbose Logging

Enable verbose logs with the following call:

AppLovinMAX.setVerboseLogging(true);

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

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

InterstitialAd.addAdLoadedEventListener((adInfo: 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:

InterstitialAd.addAdRevenuePaidListener((adInfo: AdRevenueInfo) => {…});
RewardedAd.addAdRevenuePaidListener((adInfo: AdRevenueInfo) => {…});
BannerAd.addAdRevenuePaidListener((adInfo: AdRevenueInfo) => {…});
MRecAd.addAdRevenuePaidListener((adInfo: AdRevenueInfo) => {…});
AppOpenAd.addAdRevenuePaidListener((adInfo: AdRevenueInfo) => {…});
InterstitialAd.addAdRevenuePaidListener((adInfo: AdRevenueInfo) => {
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
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
});

Selective Init

Starting in React Native module version 6.1.0, 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. If so, it initializes all networks that you have configured for them.) The following example shows how you implement this feature:

AppLovinMAX.setInitializationAdUnitIds([ "«ad-unit-ID-1»", "«ad-unit-ID-2»" ]);
AppLovinMAX.initialize(«SDK-key»).then((conf: Configuration) => { ... });

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 React Native plugin version 3.1.1.

adLoadState Values

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

Example

InterstitialAd.addAdLoadedEventListener((adInfo: 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: AdNetworkResponseInfo) => {
console.log('Network name:' + networkResponse.mediatedNetwork.name +
' adapterClassName:'+ networkResponse.mediatedNetwork.adapterClassName +
' sdkVersion:' + networkResponse.mediatedNetwork.sdkVersion +
' adapterVersion:' + networkResponse.adapterVersion);
console.log('...adLoadState:' + networkResponse.adLoadState);
console.log('...latency:' + networkResponse.latencyMillis);
});
});
InterstitialAd.addAdLoadFailedEventListener((errorInfo: AdLoadFailedInfo) => {
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: AdNetworkResponseInfo) => {
console.log('Network name:' + networkResponse.mediatedNetwork.name +
' adapterClassName:'+ networkResponse.mediatedNetwork.adapterClassName +
' sdkVersion:' + networkResponse.sdkVersion +
' adapterVersion:' + networkResponse.adapterVersion);
console.log('...latency:' + networkResponse.latencyMillis);
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