インタースティシャル広告
インタースティシャル広告は、アプリのインターフェイスを一時的に覆う、フル画面またはフルページ広告です。 この広告は、一般的に、ゲームのレベル完了後や主要な画面間の遷移時など、アプリ内の自然な区切りや遷移ポイントで表示されます。
次のセクションでは、インタースティシャル広告をロードし、表示する方法について説明します。
インタースティシャル広告をロード
以下のコードは、最初のインタースティシャル広告をロードする方法を示しています。
local interstitial_ad_unit_ids = { android = "«android-ad-unit-ID»", ios = "«ios-ad-unit-ID»"}
function initialize_interstitial_ads() local ad_unit_id
local sysinfo = sys.get_sys_info() if sysinfo.system_name == "Android" then ad_unit_id = interstitial_ad_unit_ids["android"] elseif sysinfo.system_name == "iPhone OS" then ad_unit_id = interstitial_ad_unit_ids["ios"] end
applovin.load_interstitial(ad_unit_id)
-- Interstitial Ad Callbackslocal function applovin_callback(self, name, params) if name == "OnInterstitialAdLoadedEvent" then -- Interstitial ad is ready to be shown. applovin.is_interstitial_ready(ad_unit_id) will now return true
if name == "OnInterstitialAdLoadFailedEvent" then⋮
if name == "OnInterstitialAdDisplayedEvent" then⋮
if name == "OnInterstitialAdDisplayFailedEvent" then⋮
if name == "OnInterstitialAdClickedEvent" then⋮
if name == "OnInterstitialAdHiddenEvent" then⋮
if name == "OnInterstitialAdRevenuePaidEvent" then⋮
インタースティシャル広告を表示
インタースティシャル広告を表示するには、show_interstitial()
を呼び出します。
if applovin.is_interstitial_ready(«ad-unit-ID») then applovin.show_interstitial(«ad-unit-ID»)