adConfig
adConfig() の呼び出しにより、ゲームの現在の設定が Ad Placement API に伝えられます。Ad Placement API を使用すると、広告のプリロード方法と、適切な広告(音声が必要な動画広告など)がリクエストされるように広告の種類をフィルタリングできます。
関数のシグネチャ:
adConfig({
preloadAdBreaks: 'on|auto', // Ad preloading strategy
sound: 'on|off' // This game has sound
onReady: () => {}, // Called when API has initialised and adBreak() is ready
});
adConfig パラメータ
名前 |
型 |
説明 |
sound |
文字列 |
(省略可)ゲームが現在音声を再生しているかどうか。値: - on (デフォルト) - off この呼び出しは、ゲームで音声が出力できるかどうか、また adBreak() を呼び出す前に音声が有効になっていた(ミュート解除されていた)かどうかを指定します。これにより、Ad Placement API がゲームに適した広告の種類を選択することができます。 ゲームの音声状態が変化したらすぐにこの関数を呼び出します。Ad Placement API が新しいクリエイティブをリクエストしなければならない場合があり、こうすることでリクエストに最大限の時間の余裕を与えることができます。
デフォルト値は音声オンです。そのため、ほとんどのゲームでは、音声が有効になっていると宣言し始めるときに adConfig() を呼び出す必要があります。 |
preloadAdBreaks |
文字列 |
(省略可)adBreak() を最初に呼び出す前に常に広告をプリロードするかどうかを指定します。値: - on - auto (デフォルト)
デフォルト値 auto にすると、Ad Placement API によって決定されます。preloadAdBreaks は adConfig() で 1 回だけ設定でき、設定した後に preloadAdBreaks に値を渡しても効果はありません。
adBreak() を最初に呼び出した後に preloadAdBreaks を設定しても、効果はありません。 |
onReady |
文字列 |
(省略可)API が初期化され、広告のプリロードが完了すると呼び出されます(上記の preloadAdBreaks を使用してプリロードをリクエストした場合)。 |
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-11-27 UTC。
[null,null,["最終更新日 2024-11-27 UTC。"],[[["`adConfig()` is used to inform the Ad Placement API about the game's settings, such as sound and ad preloading preferences, for better ad selection and delivery."],["The API uses this information to optimize ad preloading and ensure ads are suitable for the game's context, like avoiding sound-based ads in silent games."],["Developers can specify whether the game has sound enabled using the `sound` parameter and control ad preloading behavior with `preloadAdBreaks`."],["An optional `onReady` callback can be provided to notify the game when the API is initialized and ad preloading is complete, if requested."]]],["The `adConfig()` function communicates the game's settings to the Ad Placement API. It accepts parameters to configure ad behavior: `sound` (specifying if sound is 'on' or 'off'), `preloadAdBreaks` ('on' or 'auto' for preloading ads), and `onReady` (a callback after initialization). `sound` informs the API of the game's sound capability and status, influencing ad selection. `preloadAdBreaks` dictates ad preloading strategy, set only once.\n"]]