コンテンツにスキップ

アドバンス設定

広告プレースメント

各広告ユニットにプレースメント名を設定することができます(例:「Rewarded VideoLevels」、「INTER_levelEnd」、「RewardedVideoCoinStore」など)。 これにより、異なるプレースメントカテゴリーの統計を集計することができます。 以下のスニペットは、さまざまな広告フォーマットのプレースメント名を設定する方法を示しています。

バナー / MREC

adView.placement = @"«placement»";
[adView loadAd];

インタースティシャル広告

[interstitialAd showAdForPlacement: @"«placement»"];

リワード広告

[rewardedAd showAdForPlacement: @"«placement»"];

ネイティブ広告

nativeAdLoader.placement = @"«placement»";

ネイティブ広告(Ad Placer)

MAAdPlacerSettings *settings = [MAAdPlacerSettings settingsWithAdUnitIdentifier: @"«ad-unit-ID»"];
settings.placement = @"«placement»";

音声をミュート

アプリを起動する際に、一部のメディエーションSDKネットワークの音声をミュートすることができます。 AppLovin SDKをとおしてこの機能をサポートしているネットワークは、Google Bidding、 Google AdMob 、AppLovin、DT Exchange、 Google アド マネージャー、LINE、Mintegral、Tencent、Verveです。 他のネットワークについては、この機能が利用可能かどうか、またそのアクセス方法について、ネットワークのアカウントチームにお問い合わせください。

以下のコードスニペットは、この機能をサポートするネットワークで音声をミュートする方法を示しています。

ALSdk *sdk = [ALSdk shared];
sdk.settings.muted = YES; // to mute
sdk.settings.muted = NO; // to unmute

Verboseログを有効化

詳細ログを有効にする方法は2つあります。

プログラムで

SDKの設定オブジェクト内でフラグ isVerboseLoggingEnabledYES に設定することで、詳細ログを有効にできます。

[ALSdk shared].settings.verboseLoggingEnabled = YES;

Info.plist

アプリケーションの Info.plistAppLovinVerboseLoggingOnYES に設定することでも、詳細ログを有効にできます。

Key: Information Property List. Type: Dictionary. Value: (1 item). Key: AppLovinVerboseLoggingOn. Type: Boolean. Value: YES.

検証

Verboseログを正常に有効化したことを確認するには、AppLovin SDKのログの初期化セクションに、Verbose Logging On: trueと表示される行を確認してください。

AppLovin SDK
Version: 11.4.2
Verbose Logging On: true

AppLovin SDKは、そのログに「/AppLovinSdk: [AppLovinSdk]」というタグを付けます。

クリエイティブIDとネットワーク名

さまざまなメディエーションネットワークから表示された広告のクリエイティブIDとネットワーク名を取得できます。 詳細については、the Creative Debugger documentation を参照してください。

DSP名

AppLovin Exchangeから配信されるMAX広告のDSP名を、次のようなコードで取得することができます。

- (void)didLoadAd:(MAAd *)ad
{
NSLog(@"AppLovin Exchange DSP name: %@", ad.DSPName);
}

インプレッションレベルのユーザー収益API

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 refer to the Impression-Level User Revenue API for MMPs page.

サポートされているすべてのネットワークに対して、Adjust などのモバイル計測パートナーとインプレッションレベルの広告収益データを共有できます。

すべての広告ライフサイクルコールバックで、収益額を取得できます。 以下の例は、「ad revenue paid」コールバックでこれを行う方法を示しています。

- (void)didPayRevenueForAd:(MAAd *)ad
{
double revenue = ad.revenue; // In USD
// Miscellaneous data
NSString *countryCode = [ALSdk shared].configuration.countryCode; // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD"
NSString *networkName = ad.networkName; // Display name of the network that showed the ad
NSString *adUnitId = ad.adUnitIdentifier; // The MAX Ad Unit ID
MAAdFormat *adFormat = ad.format; // The ad format of the ad (e.g. BANNER, MREC, INTERSTITIAL, REWARDED)
NSString *placement = ad.placement; // The placement this ad's postbacks are tied to
NSString *networkPlacement = ad.networkPlacement; // The placement ID from the network that showed the ad
}

以下の例のように、収益値の精度評価を取得することもできます。

NSString *revenuePrecision = ad.revenuePrecision;

この精度は、以下のいずれかの値を取ります。

"publisher_defined"
収益額はパブリッシャーによって指定された価格です
"exact"
収益額はリアルタイムオークションによって算出されます
"estimated"
収益額はAuto-CPMまたはFBビディングの推定に基づいています
"undefined"
収益額が定義されておらず、推定するのに十分なデータがありません
""
収益と精度が有効ではありません(テストモードなど)

広告リクエストコールバックの設定

MAAdRequestDelegate を設定し、その[didStartAdRequestForAdUnitIdentifier:] メソッドを実装し、requestDelegate にデリゲートを設定することで、広告リクエストが行われたのを検知することができます。 以下の例では、そのような「広告リクエストを開始」するためのコールバックの実装方法を示します。

- (void)didStartAdRequestForAdUnitIdentifier:(NSString *)adUnitIdentifier
{
// Ad request started here
}

Selective Init

ALSdkInitializationConfiguration内の広告ユニットを指定してSDKを初期化できます。 このときSDKは、指定の広告ユニットに設定されたネットワークのみを初期化します。 広告ユニットを指定しない場合、SDKは、現在のセッションですべての広告ユニットが必要だと見なします。 その結果、広告ユニットに設定したネットワークがすべて初期化されます。 以下の例は、この機能の実装方法を示したものです。

ALSdkInitializationConfiguration *initConfig = [ALSdkInitializationConfiguration configurationWithSdkKey:«your-SDK-key»
builderBlock:^(ALSdkInitializationConfigurationBuilder *builder) {
builder.mediationProvider = ALMediationProviderMAX;
builder.adUnitIdentifiers = @[@"«ad-unit-ID-1»", @"«ad-unit-ID-2»"];
}];
[[ALSdk shared] initializeWithConfiguration: initConfig completionHandler:^(ALSdkConfiguration *sdkConfig) {
}];

SDK KeyはAppLovinダッシュボードのAccount > General > Keys のセクションにてご確認ください。

Waterfall Information API

Waterfall Information APIは、広告の現在のウォーターフォール(ロードされたもの、またはロードに失敗したもの)について通知します。APIは、ウォーターフォール内の各広告のロード状態、待ち時間、資格情報、およびメディエーションネットワーク情報を返します。 ウォーターフォール内の広告がロードに失敗した場合、APIはエラー情報を提供します。

AdLoadStateの値

説明
0Ad Load Not Attempted
1Ad Loaded
2Ad Failed To Load

- (void)didLoadAd:(MAAd *)ad
{
NSLog(@"Waterfall Name: %@ and Test Name: %@", ad.waterfall.name, ad.waterfall.testName);
NSLog(@"Waterfall latency was: %f seconds", ad.waterfall.latency);
for (MANetworkResponseInfo *networkResponse in ad.waterfall.networkResponses)
{
NSLog(@"Network -> %@", networkResponse.mediatedNetwork);
NSLog(@"...adLoadState: %ld", (long) networkResponse.adLoadState);
NSLog(@"...latency: %f seconds", networkResponse.latency);
NSLog(@"...credentials: %@", networkResponse.credentials);
if (networkResponse.error) {
NSLog(@"...error: %@", networkResponse.error);
}
}
}
- (void)didFailToLoadAdForAdUnitIdentifier:(NSString *)adUnitIdentifier withError:(MAError *)error
{
if (!error.waterfall) {
return;
}
MAAdWaterfallInfo *waterfall = error.waterfall;
NSLog(@"Waterfall Name: %@ and Test Name: %@", waterfall.name, waterfall.testName);
NSLog(@"Waterfall latency was: %f seconds", waterfall.latency);
for (MANetworkResponseInfo *networkResponse in waterfall.networkResponses)
{
NSLog(@"Network -> %@", networkResponse.mediatedNetwork);
NSLog(@"...latency: %f seconds", networkResponse.latency);
NSLog(@"...credentials: %@", networkResponse.credentials);
if (networkResponse.error) {
NSLog(@"...error: %@", networkResponse.error);
}
}
}

ウォーターフォールが空の場合、MAError.waterfallnil を返すため、ウォーターフォールモデルのプロパティを確認することはできません。 ただし、空のウォーターフォールであっても requestLatency を使用して広告のロード遅延を取得することは可能です。

- (void)didLoadAd:(MAAd *)ad
{
NSLog(@"Succesful ad load latency: %f seconds", ad.requestLatency);
}
- (void)didFailToLoadAdForAdUnitIdentifier:(NSString *)adUnitIdentifier withError:(MAError *)error
{
NSLog("Failed ad load latency: %f seconds", error.requestLatency);
}

バナー広告 / MREC広告のリフレッシュをカスタマイズ

バナー広告およびMREC広告のリフレッシュ間隔は、Ad Unitの UIで設定できるように、連携ごとに直接カスタマイズすることが可能です。 リフレッシュ間隔の最小値は10秒、最大値は120秒です。 この範囲内に含まれない値は対象外となります。 以下のコードサンプルでは、これらのリフレッシュ間隔をカスタマイズする方法を示しています。

// Where adView is an instance of MAAdView
[adView setExtraParameterForKey: @"ad_refresh_seconds" value: «ad-refresh-rate»];

オーディオ設定

インタースティシャルおよびリワードの広告音声がアプリのバックグラウンドオーディオに干渉しないようにするために、AppLovinは広告を表示する前にアプリのバックグラウンドオーディオを停止することを推奨します。 広告を非表示にした後、アプリのバックグラウンドオーディオを再開できます。

- (void)didDisplayAd:(MAAd *)ad
{
// Pause your app's background audio
}
- (void)didHideAd:(MAAd *)ad
{
// Resume your app's background audio
}