LevelPlay Listener と Ad Info の実装
ironSource SDK 7.2.3 から、ネットワーク、セグメント、A/B など、より多くのデータを広告コールバックで受け取ることが可能になりました。
新しい広告ユニットリスナーの実装
AdInfo コールバックを発火する、新しい LevelPlay Listener を実装します。
AdInfo はロードに成功した直近の広告データであり、表示できる広告在庫がない場合に発火するロード失敗のコールバックには含まれません。
データの重複を防ぐため、既存のリスナーの登録を解除することを推奨しています。
動画リワード
以下の様にリスナーをイベントへ登録します:
// Add AdInfo Rewarded Video Events
IronSourceRewardedVideoEvents.onAdOpenedEvent += RewardedVideoOnAdOpenedEvent;
IronSourceRewardedVideoEvents.onAdClosedEvent += RewardedVideoOnAdClosedEvent;
IronSourceRewardedVideoEvents.onAdAvailableEvent += RewardedVideoOnAdAvailable;
IronSourceRewardedVideoEvents.onAdUnavailableEvent += RewardedVideoOnAdUnavailable;
IronSourceRewardedVideoEvents.onAdShowFailedEvent += RewardedVideoOnAdShowFailedEvent;
IronSourceRewardedVideoEvents.onAdRewardedEvent += RewardedVideoOnAdRewardedEvent;
IronSourceRewardedVideoEvents.onAdClickedEvent += RewardedVideoOnAdClickedEvent;
プラグインは、以下にリストされているすべての発生しうるイベントをリスナーに通知します:
/************* RewardedVideo AdInfo Delegates *************/
// Indicates that there's an available ad.
// The adInfo object includes information about the ad that was loaded successfully
// This replaces the RewardedVideoAvailabilityChangedEvent(true) event
void RewardedVideoOnAdAvailable(IronSourceAdInfo adInfo) {}
// Indicates that no ads are available to be displayed
// This replaces the RewardedVideoAvailabilityChangedEvent(false) event
void RewardedVideoOnAdUnavailable() {}
// The Rewarded Video ad view has opened. Your activity will loose focus.
void RewardedVideoOnAdOpenedEvent(IronSourceAdInfo adInfo) {}
// The Rewarded Video ad view is about to be closed. Your activity will regain its focus.
void RewardedVideoOnAdClosedEvent(IronSourceAdInfo adInfo) {}
// The user completed to watch the video, and should be rewarded.
// The placement parameter will include the reward data.
// When using server-to-server callbacks, you may ignore this event and wait for the ironSource server callback.
void RewardedVideoOnAdRewardedEvent(IronSourcePlacement placement, IronSourceAdInfo adInfo) {}
// The rewarded video ad was failed to show.
void RewardedVideoOnAdShowFailedEvent(IronSourceError error, IronSourceAdInfo adInfo) {}
// Invoked when the video ad was clicked.
// This callback is not supported by all networks, and we recommend using it only if
// it's supported by all networks you included in your build.
void RewardedVideoOnAdClickedEvent(IronSourcePlacement placement, IronSourceAdInfo adInfo) {}
Note:
IronSourceRewardedVideoEvents へ実装を更新する場合は、onRewardedVideoAvailabilityChangedEvent の代わりに onAdAvailableEvent と onAdUnavailableEvent を使用してください。
動画リワード手動ロード
動画リワード手動ロードを実装する場合は、以下のイベントを使用してください:
// Add AdInfo Rewarded Video Events
IronSourceRewardedVideoEvents.onAdReadyEvent += RewardedVideoOnAdReadyEvent;
IronSourceRewardedVideoEvents.onAdLoadFailedEvent += RewardedVideoOnAdLoadFailedEvent;
IronSourceRewardedVideoEvents.onAdOpenedEvent += RewardedVideoOnAdOpenedEvent;
IronSourceRewardedVideoEvents.onAdClosedEvent += RewardedVideoOnAdClosedEvent;
IronSourceRewardedVideoEvents.onAdShowFailedEvent += RewardedVideoOnAdShowFailedEvent;
IronSourceRewardedVideoEvents.onAdRewardedEvent += RewardedVideoOnAdRewardedEvent;
IronSourceRewardedVideoEvents.onAdClickedEvent += RewardedVideoOnAdClickedEvent;
プラグインは、以下にリストされているすべての発生しうるイベントをリスナーに通知します:
/************* RewardedVideo AdInfo Delegates *************/
// Indicates that the Rewarded video ad was loaded successfully.
// AdInfo parameter includes information about the loaded ad
void RewardedVideoOnAdReadyEvent(IronSourceAdInfo adInfo) {}
// Indicates that the Rewarded video ad failed to be loaded
void RewardedVideoOnAdLoadFailedEvent(IronSourceError error) {}
// The Rewarded Video ad view has opened. Your activity will loose focus.
void RewardedVideoOnAdOpenedEvent(IronSourceAdInfo adInfo) {}
// The Rewarded Video ad view is about to be closed. Your activity will regain its focus.
void RewardedVideoOnAdClosedEvent(IronSourceAdInfo adInfo) {}
// The user completed to watch the video, and should be rewarded.
// The placement parameter will include the reward data.
// When using server-to-server callbacks, you may ignore this event and wait for the ironSource server callback.
void RewardedVideoOnAdRewardedEvent(IronSourcePlacement placement, IronSourceAdInfo adInfo) {}
// The rewarded video ad was failed to show.
void RewardedVideoOnAdShowFailedEvent(IronSourceError error, IronSourceAdInfo adInfo) {}
// Invoked when the video ad was clicked.
// This callback is not supported by all networks, and we recommend using it only if
// it's supported by all networks you included in your build.
void RewardedVideoOnAdClickedEvent(IronSourcePlacement placement, IronSourceAdInfo adInfo) {}
インタースティシャル
以下の様にリスナーをイベントへ登録します:
//Add AdInfo Interstitial Events
IronSourceInterstitialEvents.onAdReadyEvent += InterstitialOnAdReadyEvent;
IronSourceInterstitialEvents.onAdLoadFailedEvent += InterstitialOnAdLoadFailed;
IronSourceInterstitialEvents.onAdOpenedEvent += InterstitialOnAdOpenedEvent;
IronSourceInterstitialEvents.onAdClickedEvent += InterstitialOnAdClickedEvent;
IronSourceInterstitialEvents.onAdShowSucceededEvent += InterstitialOnAdShowSucceededEvent;
IronSourceInterstitialEvents.onAdShowFailedEvent += InterstitialOnAdShowFailedEvent;
IronSourceInterstitialEvents.onAdClosedEvent += InterstitialOnAdClosedEvent;
プラグインは、以下にリストされているすべての発生しうるイベントをリスナーに通知します:
/************* Interstitial AdInfo Delegates *************/
// Invoked when the interstitial ad was loaded successfully.
void InterstitialOnAdReadyEvent(IronSourceAdInfo adInfo) {}
// Invoked when the initialization process has failed.
void InterstitialOnAdLoadFailed(IronSourceError ironSourceError) {}
// Invoked when the Interstitial Ad Unit has opened. This is the impression indication.
void InterstitialOnAdOpenedEvent(IronSourceAdInfo adInfo) {}
// Invoked when end user clicked on the interstitial ad
void InterstitialOnAdClickedEvent(IronSourceAdInfo adInfo) {}
// Invoked when the ad failed to show.
void InterstitialOnAdShowFailedEvent(IronSourceError ironSourceError, IronSourceAdInfo adInfo) {}
// Invoked when the interstitial ad closed and the user went back to the application screen.
void InterstitialOnAdClosedEvent(IronSourceAdInfo adInfo) {}
// Invoked before the interstitial ad was opened, and before the InterstitialOnAdOpenedEvent is reported.
// This callback is not supported by all networks, and we recommend using it only if
// it's supported by all networks you included in your build.
void InterstitialOnAdShowSucceededEvent(IronSourceAdInfo adInfo) {}
バナー
以下の様にリスナーをイベントへ登録します:
//Add AdInfo Banner Events
IronSourceBannerEvents.onAdLoadedEvent += BannerOnAdLoadedEvent;
IronSourceBannerEvents.onAdLoadFailedEvent += BannerOnAdLoadFailedEvent;
IronSourceBannerEvents.onAdClickedEvent += BannerOnAdClickedEvent;
IronSourceBannerEvents.onAdScreenPresentedEvent += BannerOnAdScreenPresentedEvent;
IronSourceBannerEvents.onAdScreenDismissedEvent += BannerOnAdScreenDismissedEvent;
IronSourceBannerEvents.onAdLeftApplicationEvent += BannerOnAdLeftApplicationEvent;
プラグインは、以下にリストされているすべての発生しうるイベントをリスナーに通知します:
/************* Banner AdInfo Delegates *************/
// Invoked each time a banner was loaded, either on refresh or on manual load
void BannerOnAdLoadedEvent(IronSourceAdInfo adInfo) {}
// Invoked when the banner loading process has failed
// The callback will be sent both for manual and refreshed banner failures.Â
void BannerOnAdLoadFailedEvent(IronSourceError ironSourceError) {}
// Invoked when end user clicks on the banner ad
void BannerOnAdClickedEvent(IronSourceAdInfo adInfo) {}
//Notifies the presentation of a full screen content following user click
void BannerOnAdScreenPresentedEvent(IronSourceAdInfo adInfo) {}
//Notifies the presented screen has been dismissed
void BannerOnAdScreenDismissedEvent(IronSourceAdInfo adInfo) {}
//Invoked when the user leaves the app
void BannerOnAdLeftApplicationEvent(IronSourceAdInfo adInfo) {}
Note:
BannerOnAdLoadedEvent と BannerOnAdLoadFailedEvent コールバックはバナーの手動ロードと自動リフレッシュの両方で発火します。
AdInfo のデータを実装する
AdInfo を含む LevelPlay Listener を実装すると、アプリ内でAdInfo のデータを使用することが出来ます。
AdInfo のデータが利用できない場合、string パラメーターは空の文字列、数字パラメーターは 0 を返します。
// Implementation example
IronSourceInterstitialEvents.onAdReadyEvent += InterstitialOnAdReadyEvent;
void InterstitialOnAdReadyEvent(IronSourceAdInfo adInfo) {
String auctionID = adInfo.auctionId;
String adUnit = adInfo.adUnit;
String country = adInfo.country;
String ab = adInfo.ab;
String segmentName = adInfo.segmentName;
String adNetwork = adInfo.adNetwork;
String instanceName = adInfo.instanceName;
String instanceId = adInfo.instanceId;
Double? revenue = adInfo.revenue;
String precision = adInfo.precision;
String encryptedCPM = adInfo.encryptedCPM;
}
Ad Info フィールド
AdInfo オブジェクトが含むパラメーターの説明とデータ型は以下のリストを参照してください:
Parameter Name | Description | Data Type |
auctionId | オークションのユニークID | String |
adUnit | 表示された広告ユニット( Rewarded Video / Interstitial / Banner ) | String |
adNetwork | 広告を表示したアドネットワーク | String |
instanceName | プラットフォームで定義されたアドネットワークインスタンス名。ビディングインスタンスの場合は「 Bidding 」 | String |
instanceId | アドネットワークで使用するID名。instanceID / placement / zone 等 | String |
country | ISO 3166-1 フォーマットの国コード | String |
revenue | インプレッションの収益( USD )。精度は推定値または確定値( precision フィールドの説明を参照) | Double |
precision | revenue フィールドの精度: BID – リアルタイムオークションで入札された収益値( Meta ビディング以外) RATE – パブリッシャーが LevelPlay プラットフォームでインスタンスに設定した金額 CPM – インスタンスの LevelPlay 上での過去のパフォーマンスを元に計算された値 |
String |
ab | LevelPlay プラットフォームで A/B テストが有効な場合、所属するグループ | String |
segmentName | セグメントのメソッドを元に定義されたユーザが所属するセグメント名 | String |
encryptedCPM | Meta Audience Network 広告のみ。Meta Audience Network により Closed Beta として承認されているパブリッシャーへのみ配信される暗号化された CPM | String |