全画面動画広告

全画面動画広告は、高いeCPMでの収益化が期待できる15~30秒程度のスキップ可能な動画広告です。ブランドやゲーム開発者に好まれる動画広告は、ステージクリア/レベル上昇時の待ち時間、PVP(オンライン対人型)ゲームの待ち時間に最適です。動画広告は視覚、聴覚に加え、動的な表現力を活用してユーザーを夢中にさせる様なアプリ内広告の体験を提供できます。

動画広告を実装するには、まずインタースティシャル広告プレースメントを作成する必要があります。いったんインタースティシャル広告プレースメントを作成すると、InMobiポータルから静止画広告と動画広告の組み合わせか、動画のみの広告を表示するかのどちらかをコントロールできます。

また、より高度な動画コントロールとして、ユーザがWifi接続時にのみ動画広告を表示したり、スキップ可能な動画広告のみを表示したりといった設定が可能です。

以下の手順に従い、動画広告での収益化を開始してください。

全画面動画広告の設定

アプリを追加してから、 インタースティシャルを選択して広告タイプ インタースティシャル向けのプレースメントを作成します。

インタースティシャルプレースメントを作成したら、プレースメントIDが手に入ります。

全画面動画広告の作成

IMInterstitialは、UIViewController のサブクラスで、ユーザーのタッチに応答する全画面広告を表示します。

以下の手順に従って、プログラムでインタースティシャル広告ユニットを作成します。

  1. ヘッダーをインポートして、ViewController.hファイルでインタースティシャル インスタンスを宣言します。ViewControllerヘッダーファイルは次のようになります。

    #import  <uikit uikit.h="">
    @import InMobiSDK;
    @interface ViewController : UIViewController <iminterstitialdelegate>
    @property (nonatomic, strong) IMInterstitial *interstitial;
    @end
    		</iminterstitialdelegate></uikit>
    
  2. インタースティシャル オブジェクトのインスタンスを作成します。ViewController.mファイル内の viewDidLoad メソッドは次のようになります。

    -(void)viewDidLoad {
     [super viewDidLoad];
    self. interstitial = [[IMInterstitial alloc] initWithPlacementId:@"Insert your placement ID here"];
    self. interstitial.delegate = self;
    [self.interstitial load];
    }
    		
    


    重要事項:プレースメントIDごとに1つのオブジェクトだけを作成して、その後の広告の読み込みにはそれを再使用してください。

  3. 広告ステータスのコールバックについては、IMInterstitialのデリゲートプロパティを実装します。以下のコールバックがサポートされます。

    /*Indicates that the interstitial is ready to be shown */
    - (void)interstitialDidFinishLoading:(IMInterstitial *)interstitial {
        NSLog(@"interstitialDidFinishLoading");
    }
    /* Indicates that the interstitial has failed to receive an ad. */
    - (void)interstitial:(IMInterstitial *)interstitial didFailToLoadWithError:(IMRequestStatus *)error {
        NSLog(@"Interstitial failed to load ad");
        NSLog(@"Error : %@",error.description);
    }
    /* Indicates that the interstitial has failed to present itself. */
    - (void)interstitial:(IMInterstitial *)interstitial didFailToPresentWithError:(IMRequestStatus *)error {
        NSLog(@"Interstitial didFailToPresentWithError");
        NSLog(@"Error : %@",error.description);
    }
    /* indicates that the interstitial is going to present itself. */
    - (void)interstitialWillPresent:(IMInterstitial *)interstitial {
        NSLog(@"interstitialWillPresent");
    }
    /* Indicates that the interstitial has presented itself */
    - (void)interstitialDidPresent:(IMInterstitial *)interstitial {
        NSLog(@"interstitialDidPresent");
    }
    /* Indicates that the interstitial is going to dismiss itself. */
    - (void)interstitialWillDismiss:(IMInterstitial *)interstitial {
        NSLog(@"interstitialWillDismiss");
    }
    /* Indicates that the interstitial has dismissed itself. */
    - (void)interstitialDidDismiss:(IMInterstitial *)interstitial {
        NSLog(@"interstitialDidDismiss");
    }
    /* Indicates that the user will leave the app. */
    - (void)userWillLeaveApplicationFromInterstitial:(IMInterstitial *)interstitial {
        NSLog(@"userWillLeaveApplicationFromInterstitial");
    }
    /* interstitial:didInteractWithParams: Indicates that the interstitial was interacted with. */
    - (void)interstitial:(IMInterstitial *)interstitial didInteractWithParams:(NSDictionary *)params {
        NSLog(@"InterstitialDidInteractWithParams");
    }
    /* Not used for direct integration. Notifies the delegate that the ad server has returned an ad but assets are not yet available. */
    - (void)interstitialDidReceiveAd:(IMInterstitial *)interstitial {
      NSLog(@"interstitialDidReceiveAd");
    }
    		
    
  4. インタースティシャル広告を表示するには、次のコードを使用します。

    [self.interstitial showFromViewController:self];
    //[self.interstitial showFromViewController:self withAnimation:kIMInterstitialAnimationTypeCoverVertical];
    		
    


    以下が利用可能なアニメーションのタイプです。

    • kIMInterstitialAnimationTypeCoverVertical
    • kIMInterstitialAnimationTypeFlipHorizontal
    • kIMInterstitialAnimationTypeNone

重要事項:

  • showFromViewControllerに対して呼び出す前にinterstitialDidFinishLoadingデリゲートが発生していることを確認してください。状態が異なる場合、エラーコールバックinterstitial:didFailToPresentScreenWithError:が発生します。インタースティシャルのステータスを確認し続けながら、広告が完全に読み込まれた場合のみ表示を呼び出します。
  • インタースティシャル広告が表示され、その後に閉じられるたびに、再度[self.interstitial load]; を呼び出す必要があります。 これを実行しないと、showFromViewControllerを再度呼び出せなくなります。

取得CreativeID

時には、広告品質のチェックをすべて逃れた不正な広告主様が、無関係で不快なものや混乱するものをユーザーに表示することで、アプリのユーザーエクスペリエンスを損なうことになります。 このような状況への対応策として、広告インスタンスのcreativeIDを取得し、InMobiの連絡先に暗号化されたクcreativeIDでレポートし直します。

mInterstitialAd.creativeId // mInterstitialAdはサンプルインスタンスです。

インテグレーションのテスト

  1. InMobiポータルでテストモードを設定します。

    [ツール] - [診断]に進み、テストモードを グローバルオンセレクティブオンのどちらかに切り替えます。

    アプリに対する広告インテグレーションが初めての場合 テストモードグローバルオンに設定します。
    特定のテスト用端末にのみテスト用広告を配信したい場合 -

    アプリに対して既にSDKを実装済みで、特定の更新部分などのテストをテスト用の端末に限定して実施する必要がある場合。
    テストモードセレクティブオンに設定します。

    デバイスセクションでテスト端末を登録します。

    1. デバイスIDボックスに、デバイスIDを入力します。
    2. デバイス名ボックスで、任意の名前を設定します。
    3. [デバイスを追加]をクリックしてテスト端末を追加登録します。

    すでに登録済みのデバイスがある場合は、その端末を選択し、テストモードを有効に設定できます。

    注意: テスト完了後、本番稼働する前にテストモードをオフにしなければなりません。そうしないと、お客様のアプリは収益化できません。

    これで、テスト広告を取得するための準備が整いました。

    デバイスIDの取得

    ここでのデバイスIDは、基本的にIDFAまたはIFA (広告の識別子)を指します。デバイスIDを取得するための、最も簡単なアプローチは、SDKのログレベルを“debug”に設定することです。デバッグログを有効にするには、以下を AppDelegate.mファイル内の didFinishLaunchingWithOptionsメソッドに追加することです。

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {    
    	//Initialize InMobi SDK with your account ID
    [IMSdk initWithAccountID:@"Insert InMobi account ID here"];
    //Set log level to Debug
    [IMSdk setLogLevel:kIMSDKLogLevelDebug]; 
    	// Do your stuff.
    	return YES;
    }
    		
    


    デバッグモードでは、デバイスIDは以下の様にXCode開発者コンソールに出力されます。 “Publisher device ID is <device-id>”</device-id>

    お客様はこのデバイスIDを デバイスIDボックスに入力できます。

  2. [診断]タブ上でテストモード時の広告ユニット別のレポート値を確認できます。実装が正しく行われたか確認するのに役立ちます。
  3. また、インタースティシャル広告のロードに成功すると、コンソール内に以下のInMobi SDKのログも出力されるはずです。

    [InMobi] InMobi SDK initialized with account id: <your account="" here="" id="" />

    [InMobi] Fetching interstitial ad for placement id: <your here="" id="" placement="" />

    [InMobi] Publisher device id is <device here="" id="" />

    [InMobi] Interstitial ad successfully fetched for placement id: <your here="" id="" placement="" />

  4. これで、InMobiテスト広告もアプリケーション上で表示できます。
  5. 広告の作成前にSDKが正しく初期化されない場合は、通常以下のログが表示されます。

    ** ERROR ** [InMobi] ___ Please initialize the SDK before creating a <ad format=""> ad </ad >

    ** ERROR ** [InMobi] ___ Account id cannot be null or empty. Please provide a valid Account id.

    [InMobi] Invalid account id passed to init. Please provide a valid account id.

キーとなるログの一覧を以下に記します。

SDK初期化

シナリオ ログ レベル ログ
NULLまたは空白のアカウントIDを渡した場合。 Error Account id cannot be null or empty. Please provide a valid Account id.
有効なアカウントIDを渡した場合。 Debug InMobi SDK initialized with account id: <account id="" />
無効なアカウントIDを渡した場合。 Error Invalid account id passed to init. Please provide a valid account id.
より新しいバージョンのSDKが入手可能な場合。 Debug A newer version (ver. 6.0.0) of the InMobi SDK is available! You are currently on an older version (ver. 5.3.1). Download the latest InMobi SDK from http://www.inmobi.com/products/sdk/#downloads

広告のライフサイクルで出力される主なログ

シナリオ ログ レベル ログ
ネットワークが使用できない状況で広告がリクエストされた場合。 Error Network not reachable currently. Please try again.
広告が読み込み中または利用可能な状態のときに広告がリクエストされた場合。 Error An ad load is already in progress. Please wait for the load to complete before requesting for another ad (Placement id : <placement id="" /> ).
ユーザーが広告を閲覧中に広告がリクエストされた場合。 Error An ad is currently being viewed by the user. Please wait for the user to close the ad before requesting for another ad (Placement id : <placement id="" /> ).
デバイスID Debug Publisher device id is <device id="" />

動画広告インテグレーション時のログ

シナリオ ログ レベル ログ
SDKが初期化されていない場合。 Error Please initialize the SDK before creating a interstitial ad
無効なプレースメントIDでインタースティシャルを作成した場合。 Error Please provide a valid placement id to create a interstitial ad
インタースティシャル広告の読み込みが開始された場合。 Debug Fetching an interstitial ad for placement id: <placement id="" />
広告が正常に取得された場合。 Debug Interstitial ad successfully fetched for placement id: <placement id="" />
広告の取得に失敗した場合。 Error Failed to fetch Interstitial ad for placement id: <placement id="" /> with error:<status code="" message="" />
Webビューでインタースティシャル広告の読み込みが開始された場合。 Debug Started loading Interstitial ad markup in the webview for placement id: <placement id="" />
インタースティシャル広告が正常にWebビューに読み込まれた場合。 Debug Successfully loaded Interstitial ad markup in the webview for placement id: <placement id="" />
Webビューにインタースティシャル広告を読み込めなかった場合。 Error Failed to load the Interstitial markup in the webview for placement id: <placement id="" />
インタースティシャル広告が表示された場合。 Debug Successfully displayed Interstitial for placement id: <placement id="" />
インタースティシャル広告が閉じられた場合。 Debug Interstitial ad dismissed for placement id: <placement id="" />
広告のステータスが表示Readyの前に広告を表示しようとした場合。 Error Ad Load is not complete. Please wait for the Ad to be in a ready state before calling show
全画面広告は、ビューコントローラーなしに表示できません。ビューコントローラーを渡して全画面広告を表示してください。 Error Full screen ad cannot be displayed without a view controller. Please pass a view controller to present the full screen ad.

このページは役に立ちましたか?

このページ

最終更新日: 15 Sep, 2020