LevelPlay Listener と Ad Info の実装

ironSource SDK 7.2.3 から、ネットワーク、セグメント、A/B など、より多くのデータを広告コールバックで受け取ることが可能になりました。

新しい広告ユニットリスナーの実装

AdInfo コールバックを発火する、新しい LevelPlay Listener を実装します。

AdInfo はロードに成功した直近の広告データであり、表示できる広告在庫がない場合に発火するロード失敗のコールバックには含まれません。

データの重複を防ぐため、既存のリスナーの登録を解除することを推奨しています。

動画リワード

+ (void)setLevelPlayRewardedVideoDelegate:(nullable id<LevelPlayRewardedVideoDelegate>)delegate;

#pragma mark - LevelPlayRewardedVideoDelegate
/**
 Called after a rewarded video has changed its availability to true.
 @param adInfo The info of the ad.
 Replaces the delegate rewardedVideoHasChangedAvailability:(true)available 
 */
- (void)hasAdAvailableWithAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after a rewarded video has changed its availability to false.
 Replaces the delegate rewardedVideoHasChangedAvailability:(false)available 
 */
- (void)hasNoAvailableAd {}

/**
 Called after a rewarded video has been viewed completely and the user is eligible for a reward.
 @param placementInfo An object that contains the placement's reward name and amount.
 @param adInfo The info of the ad.
 */
- (void)didReceiveRewardForPlacement:(ISPlacementInfo *)placementInfo withAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after a rewarded video has attempted to show but failed.
 @param error The reason for the error
 @param adInfo The info of the ad.
 */
- (void)didFailToShowWithError:(NSError *)error andAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after a rewarded video has been opened.
 @param adInfo The info of the ad.
 */
- (void)didOpenWithAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after a rewarded video has been dismissed.
 @param adInfo The info of the ad.
 */
- (void)didCloseWithAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after a rewarded video has been 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
 @param adInfo The info of the ad.
 */
- (void)didClick:(ISPlacementInfo *)placementInfo withAdInfo:(ISAdInfo *)adInfo {}

Note: ISRewardedVideoDelegate から LevelPlayRewardedVideoDelegate へ実装を更新する場合は、rewardedVideoHasChangedAvailability の代わりに hasAdAvailableWithAdInfo と hasNoAvailableAd を使用してください。

動画リワード手動ロード

+ (void)setLevelPlayRewardedVideoManualDelegate:(nullable id<LevelPlayRewardedVideoManualDelegate>)delegate;

#pragma mark - LevelPlayRewardedVideoManualDelegate
/**
 Called after an rewarded video has been loaded in manual mode
 @param adInfo The info of the ad.
 */
- (void)didLoadWithAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after a rewarded video has attempted to load but failed in manual mode
 @param error The reason for the error
 */
- (void)didFailToLoadWithError:(NSError *)error {}

/**
 Called after a rewarded video has been viewed completely and the user is eligible for a reward.
 @param placementInfo An object that contains the placement's reward name and amount.
 @param adInfo The info of the ad.
 */
- (void)didReceiveRewardForPlacement:(ISPlacementInfo *)placementInfo withAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after a rewarded video has attempted to show but failed.
 @param error The reason for the error
 @param adInfo The info of the ad.
 */
- (void)didFailToShowWithError:(NSError *)error andAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after a rewarded video has been opened.
 @param adInfo The info of the ad.
 */
- (void)didOpenWithAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after a rewarded video has been dismissed.
 @param adInfo The info of the ad.
 */
- (void)didCloseWithAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after a rewarded video has been 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
 @param adInfo The info of the ad.
 */
- (void)didClick:(ISPlacementInfo *)placementInfo withAdInfo:(ISAdInfo *)adInfo{}

インタースティシャル

+ (void)setLevelPlayInterstitialDelegate:(nullable id<LevelPlayInterstitialDelegate>)delegate;

#pragma mark - LevelPlayInterstitialDelegate
/**
 Called after an interstitial has been loaded
 @param adInfo The info of the ad.
 */
- (void)didLoadWithAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after an interstitial has attempted to load but failed.
 @param error The reason for the error
 */
- (void)didFailToLoadWithError:(NSError *)error {}

/**
 Called after an interstitial has been opened. 
 This is the indication for impression. 
 @param adInfo The info of the ad.
 */
- (void)didOpenWithAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after an interstitial has been dismissed.
 @param adInfo The info of the ad.
 */
- (void)didCloseWithAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after an interstitial has attempted to show but failed.
 @param error The reason for the error
 @param adInfo The info of the ad.
 */
- (void)didFailToShowWithError:(NSError *)error andAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after an interstitial has been clicked.
 @param adInfo The info of the ad.
 */
- (void)didClickWithAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after an interstitial has been displayed on the screen.
 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. 
 @param adInfo The info of the ad.
 */
- (void)didShowWithAdInfo:(ISAdInfo *)adInfo {}

バナー

+ (void)setLevelPlayBannerDelegate:(nullable id<LevelPlayBannerDelegate>)delegate;

#pragma mark - LevelPlayBannerDelegate
/**
 Called after each banner ad has been successfully loaded, either a manual load or banner refresh
 @param adInfo The info of the ad.
 */
- (void)didLoad:(ISBannerView *)bannerView withAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after a banner has attempted to load an ad but failed. 
 This delegate will be sent both for manual load and refreshed banner failures. 
 @param error The reason for the error
 */
- (void)didFailToLoadWithError:(NSError *)error {}

/**
 Called after a banner has been clicked.
 @param adInfo The info of the ad.
 */
- (void)didClickWithAdInfo:(ISAdInfo *)adInfo {}

/**
 Called when a user was taken out of the application context.
 @param adInfo The info of the ad.
 */
- (void)didLeaveApplicationWithAdInfo:(ISAdInfo *)adInfo {}

/**
 Called when a banner presented a full screen content.
 @param adInfo The info of the ad.
 */
- (void)didPresentScreenWithAdInfo:(ISAdInfo *)adInfo {}

/**
 Called after a full screen content has been dismissed.
 @param adInfo The info of the ad.
 */
- (void)didDismissScreenWithAdInfo:(ISAdInfo *)adInfo {}

Note: didLoad と didFailToLoadWithError コールバックはバナーの手動ロードと自動リフレッシュの両方で発火します。

AdInfo のデータを実装する

AdInfo を含む LevelPlay Listener を実装すると、アプリ内でAdInfo のデータを使用することが出来ます。
AdInfo のデータが利用できない場合、string パラメーターは空の文字列、数字パラメーターは 0 を返します。

(void)didLoadWithAdInfo:(ISAdInfo *)adInfo {
   NSString *auction_id = adInfo.auction_id;
   NSString *ad_unit = adInfo.ad_unit;
   NSString *ad_network = adInfo.ad_network;
   NSString *instance_name = adInfo.instance_name;
   NSString *instance_id = adInfo.instance_id;
   NSString *country = adInfo.country;
   NSNumber *revenue = adInfo.revenue;
   NSString *precision = adInfo.precision;
   NSString *ab = adInfo.ab;
   NSString *segment_name = adInfo.segment_name;
   NSString *encrypted_cpm = adInfo.encrypted_cpm;
}

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