전면 광고

전면 광고는 사용자가 닫을 때까지 앱의 인터페이스를 완전히 덮는 전체 화면 광고입니다. 일반적으로 활동이 바뀌는 시점이나 게임에서 다음 레벨로 넘어갈 때처럼 앱 이용이 잠시 중단될 때 자연스럽게 광고가 게재됩니다. 앱에서 전면 광고가 표시될 때 사용자는 광고를 탭하여 도착 페이지로 이동하거나 광고를 닫고 앱으로 돌아갈 수 있습니다. 우수사례

이 가이드에는 전면 광고를 iOS 앱에 통합하는 방법이 나와 있습니다.

기본 요건

  • Google 모바일 광고 SDK 8.0.0 이상
  • 시작 가이드에 따라 필요한 과정을 완료합니다.

항상 테스트 광고로 테스트

앱을 제작하고 테스트할 때는 운영 중인 실제 광고 대신 테스트 광고를 사용하세요. 이렇게 하지 않으면 계정이 정지될 수 있습니다.

테스트 광고를 로드하는 가장 쉬운 방법은 다음과 같은 iOS 전면 광고 테스트 전용 광고 단위 ID를 사용하는 것입니다.
ca-app-pub-3940256099942544/4411468910

이 ID는 모든 요청에 대해 테스트 광고를 반환하도록 특별히 구성되었으며, 코딩, 테스트 및 디버깅 중에 앱에서 자유롭게 사용할 수 있습니다. 앱을 게시하기 전에 이 ID를 자체 광고 단위 ID로 바꿔야 합니다.

모바일 광고 SDK의 테스트 광고가 작동하는 방식을 자세히 알아보려면 테스트 광고를 참고하세요.

구현

전면 광고를 통합하는 기본 단계는 다음과 같습니다.

  1. 광고를 로드합니다.
  2. 콜백을 등록합니다.
  3. 광고를 표시하고 보상 이벤트를 처리합니다.

광고 로드

광고는 GADInterstitialAd 클래스의 정적 loadWithAdUnitID:request:completionHandler: 메서드를 통해 로드됩니다. 로드 메서드에는 광고 단위 ID, GADRequest 객체, 광고 로드에 성공하거나 실패할 때 호출되는 완료 핸들러가 필요합니다. 로드된 GADInterstitialAd 객체는 완료 핸들러의 매개변수로 제공됩니다. 아래 예는 ViewController 클래스에서 GADInterstitialAd를 로드하는 방법을 보여줍니다.

Swift

import GoogleMobileAds
import UIKit

class ViewController: UIViewController {

  private var interstitial: GADInterstitialAd?

  override func viewDidLoad() {
    super.viewDidLoad()

    do {
      interstitial = try await GADInterstitialAd.load(
        withAdUnitID: "ca-app-pub-3940256099942544/4411468910", request: GADRequest())
    } catch {
      print("Failed to load interstitial ad with error: \(error.localizedDescription)")
    }
  }
}

Objective-C

@import GoogleMobileAds;
@import UIKit;

@interface ViewController ()

@property(nonatomic, strong) GADInterstitialAd *interstitial;

@end

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];
  GADRequest *request = [GADRequest request];
  [GADInterstitialAd loadWithAdUnitID:@"ca-app-pub-3940256099942544/4411468910"
                              request:request
                    completionHandler:^(GADInterstitialAd *ad, NSError *error) {
    if (error) {
      NSLog(@"Failed to load interstitial ad with error: %@", [error localizedDescription]);
      return;
    }
    self.interstitial = ad;
  }];
}

콜백 등록

프레젠테이션 이벤트에 대한 알림을 받으려면 GADFullScreenContentDelegate 프로토콜을 구현하여 반환된 광고의 fullScreenContentDelegate 속성에 할당해야 합니다. GADFullScreenContentDelegate 프로토콜은 광고 표시에 성공 또는 실패했을 때와 광고가 닫혔을 때의 콜백을 처리합니다. 다음 코드는 프로토콜을 구현하고 광고에 할당하는 방법을 보여줍니다.

Swift

import GoogleMobileAds
import UIKit

class ViewController: UIViewController, GADFullScreenContentDelegate {

  private var interstitial: GADInterstitialAd?

  override func viewDidLoad() {
    super.viewDidLoad()

    do {
      interstitial = try await GADInterstitialAd.load(
        withAdUnitID: "ca-app-pub-3940256099942544/4411468910", request: GADRequest())
      interstitial?.fullScreenContentDelegate = self
    } catch {
      print("Failed to load interstitial ad with error: \(error.localizedDescription)")
    }
  }

  /// Tells the delegate that the ad failed to present full screen content.
  func ad(_ ad: GADFullScreenPresentingAd, didFailToPresentFullScreenContentWithError error: Error) {
    print("Ad did fail to present full screen content.")
  }

  /// Tells the delegate that the ad will present full screen content.
  func adWillPresentFullScreenContent(_ ad: GADFullScreenPresentingAd) {
    print("Ad will present full screen content.")
  }

  /// Tells the delegate that the ad dismissed full screen content.
  func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
    print("Ad did dismiss full screen content.")
  }
}

Objective-C

@import GoogleMobileAds;
@import UIKit;

@interface ViewController () <GADFullScreenContentDelegate>

@property(nonatomic, strong) GADInterstitialAd *interstitial;

@end

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];
  GADRequest *request = [GADRequest request];
  [GADInterstitialAd loadWithAdUnitID:@"ca-app-pub-3940256099942544/4411468910"
                              request:request
                    completionHandler:^(GADInterstitialAd *ad, NSError *error) {
    if (error) {
      NSLog(@"Failed to load interstitial ad with error: %@", [error localizedDescription]);
      return;
    }
    self.interstitial = ad;
    self.interstitial.fullScreenContentDelegate = self;
  }];
}

/// Tells the delegate that the ad failed to present full screen content.
- (void)ad:(nonnull id<GADFullScreenPresentingAd>)ad
didFailToPresentFullScreenContentWithError:(nonnull NSError *)error {
    NSLog(@"Ad did fail to present full screen content.");
}

/// Tells the delegate that the ad will present full screen content.
- (void)adWillPresentFullScreenContent:(nonnull id<GADFullScreenPresentingAd>)ad {
    NSLog(@"Ad will present full screen content.");
}

/// Tells the delegate that the ad dismissed full screen content.
- (void)adDidDismissFullScreenContent:(nonnull id<GADFullScreenPresentingAd>)ad {
  NSLog(@"Ad did dismiss full screen content.");
}

GADInterstitialAd는 일회용 객체입니다. 즉, 전면 광고가 표시된 후에는 다시 표시되지 않습니다. 이전 광고가 닫히자마자 다음 전면 광고가 로드되도록 GADFullScreenContentDelegateadDidDismissFullScreenContent: 메서드로 다른 전면 광고를 로드하는 것이 좋습니다.

광고 표시

전면 광고는 앱 이용이 잠시 중단될 때 자연스럽게 표시되어야 합니다. 예를 들어 게임에서 다음 레벨로 넘어갈 때 또는 작업을 완료한 직후가 광고를 게재하기 좋은 시점입니다. 다음은 UIViewController의 액션 메서드 중 하나에서 이를 처리하는 방법의 예입니다.

Swift

@IBAction func doSomething(_ sender: Any) {
  guard let interstitial = interstitial else {
    return print("Ad wasn't ready.")
  }

  // The UIViewController parameter is an optional.
  interstitial.present(fromRootViewController: nil)
}

Objective-C

- (IBAction)doSomething:(id)sender {
  if (self.interstitial) {
    // The UIViewController parameter is nullable.
    [self.interstitial presentFromRootViewController:nil];
  } else {
    NSLog(@"Ad wasn't ready");
  }
}

권장사항

전면 광고가 앱에 적합한 광고 유형인지 생각해 보세요.
전면 광고는 자연스러운 전환 지점이 있는 앱에서 가장 효과적입니다. 이미지 공유 또는 게임 레벨 달성과 같이 앱 내에서 작업이 완료되면 이러한 포인트가 생성됩니다. 사용자는 작업 중단을 예상하므로 사용자 경험에 지장을 주지 않고 전면 광고를 쉽게 표시할 수 있습니다. 앱 워크플로에서 전면 광고를 표시할 지점과 사용자가 어떻게 반응할지 생각해 보세요.
전면 광고를 표시할 때는 작업을 일시중지해야 합니다.
전면 광고에는 텍스트, 이미지, 동영상 등 다양한 유형이 있습니다. 앱에서 전면 광고를 표시할 때는 광고에서 리소스를 활용할 수 있도록 일부 리소스의 사용을 중지해야 합니다. 예를 들어 전면 광고를 표시하도록 호출할 때 앱에서 재생되는 오디오 출력을 일시중지해야 합니다. 사용자가 광고와의 상호작용을 마칠 때 호출되는 adDidDismissFullScreenContent: 이벤트 핸들러를 통해 사운드 재생을 재개할 수 있습니다. 또한 광고가 표시되는 동안에는 강도 높은 계산 작업 (예: 게임 루프)을 잠시 중단하는 것이 좋습니다. 이렇게 하면 그래픽이 느려지거나 응답이 없는 현상 또는 동영상 끊김 등의 문제가 사라집니다.
로드 시간을 충분히 확보하세요.
전면 광고를 적절한 시점에 표시하는 것뿐 아니라 광고 로드가 너무 지연되지 않게 하는 것도 중요합니다. 게재하기 전에 미리 광고를 로드하면 앱에서 전면 광고가 완전히 로드된 상태가 되어 광고를 게재할 수 있는 시점에 전면 광고를 바로 표시할 수 있습니다.
광고를 과도하게 게재하면 안 됩니다.
앱에 전면 광고를 더 많이 게재할수록 수익이 늘어난다고 생각할 수 있겠지만, 이렇게 하면 사용자 환경이 악화되고 클릭률이 떨어지기도 합니다. 사용자의 원활한 앱 사용에 지장을 주지 않는 범위에서 게재 빈도를 조절하시기 바랍니다.
전면 광고를 표시할 때 로드 완료 콜백을 사용하지 마세요.
사용자 환경이 저하될 수 있습니다. 광고를 표시하기 전에 미리 로드하세요. 그런 다음 GADInterstitialAdcanPresentFromRootViewController:error: 메서드에서 광고를 표시할 준비가 되었는지 확인하세요.

추가 리소스

GitHub의 예

모바일 광고 차고 동영상 가이드

성공사례

다음 단계