네이티브 광고 옵션

네이티브 광고에는 다양한 고급 기능이 있어 최상의 광고 경험을 제공할 수 있습니다. 이 가이드에서는 네이티브 광고의 고급 기능을 사용하는 방법을 알아보세요.

기본 요건

애셋 관리

선호하는 미디어 가로세로 비율 컨트롤

미디어 가로세로 비율 컨트롤을 사용하면 광고 소재를 사용합니다.

GADNativeAdMediaAdLoaderOptions mediaAspectRatio 설정 GADMediaAspectRatio 포함

  • 설정하지 않으면 반환되는 광고는 모든 미디어 가로세로 비율을 가질 수 있습니다.

  • 설정하면 선택합니다.

다음 예에서는 확인할 수 있습니다.

GADNativeAdMediaAdLoaderOptions *nativeOption = [[GADNativeAdMediaAdLoaderOptions alloc] init];
nativeOption.mediaAspectRatio = GADMediaAspectRatioAny;

GADAdLoader* adLoader = [[GADAdLoader alloc] initWithAdUnitID:@"ca-app-pub-3940256099942544/3986624511"
                                           rootViewController:self
                                                      adTypes:@[ GADAdLoaderAdTypeNative ]
                                                      options:@[ nativeOption ]];

이미지 다운로드 컨트롤

이미지 다운로드 컨트롤을 사용하면 이미지 확장 소재를 표시할지 아니면 URI만 표시할지 결정할 수 있음 SDK에 의해 반환됩니다.

GADNativeAdImageAdLoaderOptions disableImageLoading 설정 BOOL 값으로 대체합니다.
  • 이미지 다운로드 컨트롤은 기본적으로 사용 중지되어 있습니다.

  • 사용 중지하면 Google 모바일 광고 SDK가 자동으로 이미지와 URI를 모두 채웁니다.

  • 사용 설정하면 SDK가 URI만 채우며 실제 이미지를 수정할 수도 있습니다.

다음 예는 SDK가 URI만 반환하도록 지시합니다.

GADNativeAdImageAdLoaderOptions *nativeOption = [[GADNativeAdImageAdLoaderOptions alloc] init];
nativeOption.disableImageLoading = YES;

GADAdLoader* adLoader = [[GADAdLoader alloc] initWithAdUnitID:@"ca-app-pub-3940256099942544/3986624511"
                                           rootViewController:self
                                                      adTypes:@[ GADAdLoaderAdTypeNative ]
                                                      options:@[ nativeOption ]];

이미지 페이로드 컨트롤

일부 광고에는 하나의 이미지가 아닌 여러 개의 이미지가 포함되어 있습니다. 이 기능의 용도 앱이 모든 이미지를 표시할 준비가 되었는지 아니면 하나의 이미지만 표시할 준비가 되었는지 나타냅니다.

GADNativeAdImageAdLoaderOptions shouldRequestMultipleImages 설정 BOOL 값으로 대체합니다.
  • 이미지 페이로드 컨트롤은 기본적으로 사용 중지되어 있습니다.

  • 사용 중지하면 앱에서 계열이 포함된 모든 애셋의 첫 번째 이미지입니다.

  • 사용 설정하면 앱이 모든 이미지를 표시할 준비가 되었음을 나타냅니다. 로 설정합니다.

다음 예에서는 SDK가 여러 이미지 애셋을 반환하도록 지시합니다.

GADNativeAdImageAdLoaderOptions *nativeOption = [[GADNativeAdImageAdLoaderOptions alloc] init];
nativeOption.shouldRequestMultipleImages = YES;

GADAdLoader* adLoader = [[GADAdLoader alloc] initWithAdUnitID:@"ca-app-pub-3940256099942544/3986624511"
                                           rootViewController:self
                                                      adTypes:@[ GADAdLoaderAdTypeNative ]
                                                      options:@[ nativeOption ]];

AdChoices 게재위치

AdChoices 위치 컨트롤

AdChoices 위치 컨트롤을 사용하면 광고를 표시할 모서리를 AdChoices 아이콘

GADNativeAdViewAdOptions preferredAdChoicesPosition 설정 GADAdChoicesPosition 포함 값으로 사용됩니다.

  • 설정하지 않으면 AdChoices 아이콘 위치가 오른쪽 상단으로 설정됩니다.

  • 설정하면 요청에 따라 AdChoices가 맞춤 위치에 배치됩니다.

다음 예는 맞춤 AdChoices 이미지 위치를 설정하는 방법을 보여줍니다.

GADNativeAdViewAdOptions *nativeOptions = [[GADNativeAdViewAdOptions alloc] init];
nativeOptions.preferredAdChoicesPosition = GADAdChoicesPositionTopLeftCorner;

GADAdLoader* adLoader = [[GADAdLoader alloc] initWithAdUnitID:@"ca-app-pub-3940256099942544/3986624511"
                                           rootViewController:self
                                                      adTypes:@[ GADAdLoaderAdTypeNative ]
                                                      options:@[ nativeOptions ]];

AdChoices 맞춤 보기

<ph type="x-smartling-placeholder">

AdChoices 맞춤 보기 기능을 사용하면 AdChoices 아이콘을 맞춤 위치를 찾을 수 있습니다. 이는 AdChoices 위치 관리 기능을 제공하는 네 모서리 중 하나를 지정할 수 있습니다.

GADNativeAd.adChoicesView 설정 GADAdChoicesView 속성이 있는 속성 AdChoices 콘텐츠는 GADAdChoicesView입니다.

다음 예는 맞춤 AdChoices 보기를 설정하는 방법을 보여줍니다. 이 AdChoices 아이콘은 GADAdChoicesView 내에서 렌더링됩니다.

Objective-C

- (void)adLoader:(GADAdLoader *)adLoader didReceiveNativeAd:(GADNativeAd *)nativeAd {

    ...

    
    GADAdChoicesView *customAdChoicesView =
        [[GADAdChoicesView alloc] initWithFrame: CGRectMake(..., ..., ..., ...)];

    [nativeAdView addSubview:customAdChoicesView];
    nativeAdView.adChoicesView = customAdChoicesView;

    // Associate the native ad view with the native ad object. This is
    // required to make the ad clickable.
    // Note: this should always be done after populating the ad views.
    nativeAdView.nativeAd = nativeAd;
}

Swift

func adLoader(_ adLoader: GADAdLoader, didReceive nativeAd: GADNativeAd) {
    refreshAdButton.isEnabled = true

    ...
    // Define a custom position for the AdChoices icon.
    let customRect = CGRect(x: 100, y: 100, width: 15, height: 15)
    let customAdChoicesView = GADAdChoicesView(frame: customRect)
    nativeAdView.addSubview(customAdChoicesView)
    nativeAdView.adChoicesView = customAdChoicesView

    // Associate the native ad view with the native ad object. This is
    // required to make the ad clickable.
    // Note: this should always be done after populating the ad views.
    nativeAdView.nativeAd = nativeAd;
}

동영상 컨트롤

음소거 동작 시작

음소거 상태로 시작 기능을 사용하면 동영상의 시작 오디오를 사용 중지하거나 사용하도록 설정할 수 있습니다.

GADVideoOptions startMuted 설정 BOOL 값으로 대체합니다.
  • 음소거 시작 동작은 기본적으로 사용 설정되어 있습니다.

  • 사용 중지하면 앱에서 동영상이 오디오입니다.

  • 사용 설정하면 앱에서 동영상이 오디오 음소거 상태로 시작하도록 요청합니다.

다음 예는 음소거 해제된 오디오로 동영상을 시작하는 방법을 보여줍니다.

GADVideoOptions *nativeOptions = [[GADVideoOptions alloc] init];
nativeOptions.startMuted = NO;

GADAdLoader* adLoader = [[GADAdLoader alloc] initWithAdUnitID:@"ca-app-pub-3940256099942544/3986624511"
                                           rootViewController:self
                                                      adTypes:@[ GADAdLoaderAdTypeNative ]
                                                      options:@[ nativeOptions ]];

맞춤 재생 컨트롤

<ph type="x-smartling-placeholder">

이렇게 하면 동영상을 재생, 일시중지 또는 음소거하기 위해 맞춤 동영상 입력 컨트롤을 요청할 수 있습니다. 있습니다.

GADVideoOptions customControlsRequested 설정 BOOL 값으로 대체합니다.
  • 맞춤 재생 컨트롤은 기본적으로 사용 중지되어 있습니다.

  • 사용 중지하면 동영상에 SDK 렌더링 입력 컨트롤이 표시됩니다.

  • 광고에 동영상 콘텐츠가 있고 맞춤 컨트롤이 사용 설정된 경우 맞춤 컨트롤을 광고와 함께 표시하세요. 왜냐하면 광고는 제어합니다. 그러면 컨트롤은 GADVideoController

다음 예는 맞춤 재생 컨트롤을 사용하여 동영상을 요청하는 방법을 보여줍니다.

GADVideoOptions *nativeOptions = [[GADVideoOptions alloc] init];
nativeOptions.customControlsRequested = YES;

GADAdLoader* adLoader = [[GADAdLoader alloc] initWithAdUnitID:@"ca-app-pub-3940256099942544/3986624511"
                                           rootViewController:self
                                                      adTypes:@[ GADAdLoaderAdTypeNative ]
                                                      options:@[ nativeOptions ]];

맞춤 컨트롤이 사용 설정되어 있는지 확인

요청 시 반환된 광고가 게재될지 여부를 알 수 없으므로 맞춤 동영상 컨트롤이 있는 경우 맞춤 컨트롤이 사용 설정되어 있는지 확인해야 합니다.

Objective-C

- (void)adLoader:(GADAdLoader *)adLoader
    didReceiveNativeAd:(GADNativeAd*)nativeAd {

  GADVideoController *videoController = nativeAd.mediaContent.videoController;
  BOOL canShowCustomControls = videoController.customControlsEnabled;

}

Swift

func adLoader(_ adLoader: GADAdLoader, didReceive nativeAd: GADNativeAd) {
        let videoController = nativeAd.mediaContent.videoController
        let canShowCustomControls = videoController?.customControlsEnabled() == true
}

맞춤 클릭 동작

<ph type="x-smartling-placeholder">

맞춤 클릭 동작은 광고 보기에서 스와이프하면 광고 클릭으로 등록되어야 합니다. 이는 스와이프를 사용하는 앱에서 작동하도록 설계되었습니다. 동작입니다. 이 가이드에서는 맞춤 클릭을 사용 설정하는 방법을 보여줍니다. 동작을 설정할 수 있습니다.

GADNativeAdCustomClickGestureOptions 초기화 인스턴스를 표시할 수 있습니다. 또한 해당 데이터에 대해 클릭이 허용되길 바란다는 의미입니다

  • 맞춤 클릭 동작은 기본적으로 사용 중지되어 있습니다.

  • 사용 중지하면 탭만 클릭수로 계산됩니다.

  • 사용 설정하면 스와이프 동작이 클릭수로 계산되며, 여전히 클릭수로 집계할 수 있는지 여부

다음 예는 맞춤 스와이프 동작을 구현하여 일반적인 탭 동작을 유지합니다.

GADNativeAdCustomClickGestureOptions *swipeGestureOptions = [[GADNativeAdCustomClickGestureOptions alloc]
        initWithSwipeGestureDirection:UISwipeGestureRecognizerDirectionRight
                          tapsAllowed:YES];

// The following sample ad unit ID has been enabled for custom click gestures
// and can be used for testing.
self.adLoader = [[GADAdLoader alloc]
        initWithAdUnitID:@"ca-app-pub-3940256099942544/3986624511"
      rootViewController:self
                 adTypes:@[ GADAdLoaderAdTypeNative ]
                 options:@[ swipeGestureOptions ]];

스와이프 동작 이벤트 수신 대기

스와이프 동작 클릭이 기록되면 Google 모바일 광고 SDK가 nativeAdDidRecordSwipeGestureClick: 드림 GADNativeAdDelegate의 위임 메서드 , 기존 nativeAdDidRecordClick: 외에 대리자 메서드로 대체될 수 있습니다.

#pragma mark - GADNativeAdDelegate implementation

// Called when a swipe gesture click is recorded.
- (void)nativeAdDidRecordSwipeGestureClick:(GADNativeAd *)nativeAd {
  NSLog(@"A swipe gesture click has occurred.");
}

// Called when a swipe gesture click or a tap click is recorded, as configured in
// GADNativeAdCustomClickGestureOptions.
- (void)nativeAdDidRecordClick:(GADNativeAd *)nativeAd {
  NSLog(@"A swipe gesture click or tap click has occurred.");
}

미디에이션

맞춤 클릭 동작은 Google 모바일 광고 SDK가 렌더링됩니다. 다음과 같은 광고 소스 서드 파티 SDK 필요 맞춤 클릭 경로 설정에 응답하지 않습니다.