跳转到内容

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»);

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:

AppLovinMAX.setInterstitialListener(InterstitialListener(
onAdLoadedCallback: (ad) {
print("AppLovin Exchange DSP Name: " + ad.dspName);
},
);

Impression-Level User Revenue API

Starting in Flutter Plugin 2.2.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.

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.setInterstitialListener(InterstitialListener(onAdRevenuePaidCallback: (ad) {…}));
AppLovinMAX.setRewardedAdListener(RewardedAdListener(onAdRevenuePaidCallback: (ad) {…}));
AppLovinMAX.setBannerListener(AdViewAdListener(onAdRevenuePaidCallback: (ad) {…}));
AppLovinMAX.setMRecListener(AdViewAdListener(onAdRevenuePaidCallback: (ad) {…}));
AppLovinMAX.setInterstitialListener(InterstitialListener(onAdLoadedCallback: (ad) { },
onAdLoadFailedCallback: (adUnitId, error) { },
onAdDisplayedCallback: (ad) { },
onAdDisplayFailedCallback: (ad, error) { },
onAdClickedCallback: (ad) { },
onAdHiddenCallback: (ad) { },
onAdRevenuePaidCallback: (ad) {
print('Interstitial ad revenue paid: $ad.revenue');
},
));

Selective Init

Starting in Flutter plugin version 3.4.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. It then 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»" ]);
MaxConfiguration? configuration = await AppLovinMAX.initialize(«your-SDK-key»);

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 Flutter plugin version 2.3.2.

AdLoadState Values

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

Example

AppLovinMAX.setInterstitialListener(InterstitialListener(
onAdLoadedCallback: (ad) {
MaxAdWaterfallInfo waterfall = ad.waterfall;
print('Waterfall Name: ${waterfall.name} and Test Name: ${waterfall.testName}');
print('Waterfall latency was: ${waterfall.latency} milliseconds');
for (var networkResponse in waterfall.networkResponses) {
var mediatedNetwork = networkResponse.mediatedNetwork;
print('Network - mediatedNetwork: [name: ${mediatedNetwork.name} '
'adapterClassName: ${mediatedNetwork.adapterClassName} '
'sdkVersion: ${mediatedNetwork.sdkVersion} '
'adapterVersion: ${mediatedNetwork.adapterVersion}');
print('...adLoadState: ${networkResponse.adLoadState}');
print('...latencyMillis: ${networkResponse.latency}');
print('...credentials: ${networkResponse.credentials}');
var error = networkResponse.error;
if (error != null) {
print('...error code: ${error.code} message: ${error.message}');
}
}
},
onAdLoadFailedCallback: (adUnitId, error) {
MaxAdWaterfallInfo? waterfall = error.waterfall;
if (waterfall == null) return;
print('Waterfall Name: ${waterfall.name} and Test Name: ${waterfall.testName}');
print('Waterfall latency was: ${waterfall.latency} milliseconds');
for (var networkResponse in waterfall.networkResponses) {
var mediatedNetwork = networkResponse.mediatedNetwork;
print('Network - mediatedNetwork: [name: ${mediatedNetwork.name} '
'adapterClassName: ${mediatedNetwork.adapterClassName} '
'sdkVersion: ${mediatedNetwork.sdkVersion} '
'adapterVersion: ${mediatedNetwork.adapterVersion}');
print('...adLoadState: ${networkResponse.adLoadState}');
print('...latencyMillis: ${networkResponse.latency}');
print('...credentials: ${networkResponse.credentials}');
var error = networkResponse.error;
if (error != null) {
print('...error code: ${error.code} message: ${error.message}');
}
}
}
));

Output

Waterfall Name: Default Waterfall and Test Name: Control
Waterfall latency was: 1635 milliseconds
Network -> mediatedNetwork: [name: Mintegral adapterClassName: com.applovin.mediation.adapters.MintegralMediationAdapter sdkVersion: MAL_16.2.61 adapterVersion: 16.2.61.2]
...adLoadState: 1
...latencyMillis: 1635
...credentials: 1542105
Network -> mediatedNetwork: [name: InMobi adapterClassName: com.applovin.mediation.adapters.InMobiMediationAdapter sdkVersion: 10.1.2 adapterVersion: 10.1.2.1]
...adLoadState: 0
...latencyMillis: -1
...credentials: 1550734895971
Network -> mediatedNetwork: [name: LINE adapterClassName: com.applovin.mediation.adapters.LineMediationAdapter sdkVersion: 2.4.20220216 adapterVersion: 2022.2.16.3]
...adLoadState: 0
...latencyMillis: -1
...credentials: 849050
Network -> mediatedNetwork: [name: Pangle adapterClassName: com.applovin.mediation.adapters.ByteDanceMediationAdapter sdkVersion: 4.8.0.9 adapterVersion: 4.8.0.9.0]
...adLoadState: 0
...latencyMillis: -1
...credentials: 980040498