Interstitial 광고

Interstitial ads는 앱의 인터페이스를 일시적으로 가리는 전체 화면 또는 전체 페이지 광고입니다. 일반적으로 게임에서 레벨을 완료한 후나 주요 뷰 사이를 이동할 때와 같이 자연스러운 일시 중지 또는 전환 시점에 표시됩니다.

다음 섹션에서는 Interstitial 광고를 로드하고 보여주는 방법을 설명합니다.

Loading an interstitial ad

다음 코드는 이벤트 리스너를 등록하고 첫 번째 Interstitial 광고를 로드하는 방법을 보여줍니다.

var INTERSTITIAL_AD_UNIT_ID;
if (window.cordova.platformId.toUpperCase() === 'IOS') {
  INTERSTITIAL_AD_UNIT_ID = '«iOS-ad-unit-ID»';
} else {
  // Assume Android
  INTERSTITIAL_AD_UNIT_ID = '«Android-ad-unit-ID»';
}

var retryAttempt = 0;

function initializeInterstitialAds()
{
  window.addEventListener('OnInterstitialLoadedEvent', function (adInfo) {
    // Interstitial ad is ready to show. AppLovinMAX.isInterstitialReady(INTERSTITIAL_AD_UNIT_ID) now returns 'true'

    // Reset retry attempt
    retryAttempt = 0;
  });
  window.addEventListener('OnInterstitialLoadFailedEvent', function (adInfo) {
    // Interstitial ad failed to load
    // AppLovin recommends that you retry with exponentially higher delays, up to a maximum delay (in this case 64 seconds)

    retryAttempt++;
    var retryDelay = Math.pow(2, Math.min(6, retryAttempt));

    setTimeout(function () {
      loadInterstitial();
    }, retryDelay * 1000);
  });
  window.addEventListener('OnInterstitialClickedEvent', function (adInfo) {});
  window.addEventListener('OnInterstitialDisplayedEvent', function (adInfo) {});
  window.addEventListener('OnInterstitialAdFailedToDisplayEvent', function (adInfo) {
    // Interstitial ad failed to display. AppLovin recommends that you load the next ad.
    loadInterstitial();
  });
  window.addEventListener('OnInterstitialHiddenEvent', function (adInfo) {
    // Interstitial ad is hidden. Pre-load the next ad.
    loadInterstitial();
  });

  // Load the first interstitial
  loadInterstitial();
}

function loadInterstitial()
{
  AppLovinMAX.loadInterstitial(INTERSTITIAL_AD_UNIT_ID);
}

Showing an interstitial ad

Interstitial 광고를 보여주려면 showInterstitial()을 호출하세요.

if (AppLovinMAX.isInterstitialReady(«ad-unit-ID»))
{
  AppLovinMAX.showInterstitial(«ad-unit-ID»);
}

search