Native 광고

네이티브 광고를 사용하면 앱의 기존 디자인과 일관된 방식으로 앱을 수익화할 수 있습니다. AppLovin MAX SDK를 통해 광고의 개별 에셋에 액세스할 수 있습니다. 이 방식을 통해 앱의 디자인 및 느낌과 일관되도록 광고 레이아웃을 디자인할 수 있습니다. SDK가 이미지 캐싱 및 메트릭 추적을 자동으로 처리합니다. 개발자는 광고를 표시하는 방법, 시기, 위치에만 집중할 수 있습니다.

AppLovin은 템플릿 연동을 지원 중단했습니다. 템플릿을 통해 앱에 네이티브 광고를 연동하는 경우, 해당 광고는 부터 no-fill이 발생하기 시작합니다. AppLovin은 향후 SDK 릴리스에서 템플릿 연동에 대한 지원을 제거할 예정입니다.

Manual

커스텀 뷰가 있고 해당 뷰에 네이티브 광고 에셋을 수동으로 로드하려는 경우 이 API를 사용하십시오. 이 연동 방법은 크게 세 가지 단계로 구성됩니다.

  1. UI 컴포넌트 바인딩.
  2. 네이티브 광고 로드.
  3. 네이티브 광고 제거.

수동 API를 사용하려면 Create New Ad Unit 화면에서 Manual을 선택하십시오.

Template: ☐ Small, ☐ Medium, ☒ Manual

UI 컴포넌트 바인딩

커스텀 UI 컴포넌트를 MAX SDK에 바인딩하고 해당 컴포넌트에 네이티브 광고 에셋을 렌더링할 수 있습니다. 이 예제는 xib와 고유 태그 ID를 사용하여 생성된 커스텀 뷰로 이를 구현하는 방법을 보여줍니다. 프로그래밍 방식 또는 Storyboard를 사용하여 뷰를 생성하는 경우에도 이 방법을 사용할 수 있습니다.

AppLovin 정책에 따라 광고에는 반드시 개인정보 보호 정보 아이콘이 포함되어야 합니다. 이 아이콘은 중요한 개인정보 처리방침 고지로 연결됩니다. -[MANativeAdViewBinderBuilder setOptionsContentViewTag:]를 통해 바인딩할 수 있습니다. 바인딩할 UI 컴포넌트를 포함하는 커스텀 뷰는 반드시 MANativeAdView를 상속해야 합니다.

Custom Class. Class: MANativeAdView. Module: None. ☐  Inherit Module From Target.

커스텀 뷰의 서브뷰에 고유한 태그 ID를 할당하십시오. 이 ID는 다음 연동 단계에서 사용됩니다. 아래 예시 이미지는 타이틀 레이블의 ID를 1234로 설정한 모습입니다.

NativeCustomAdView. View. Tag: 1234

다음으로, MANativeAdViewBinder 인스턴스를 사용하여 고유 태그 ID로 서브뷰를 바인딩하십시오. AppLovin은 네트워크가 특정 에셋을 반환하는 것을 보장하지 않습니다.

#import "ExampleViewController.h"
#import <AppLovinSDK/AppLovinSDK.h>

⋮

@implementation ExampleViewController

⋮

- (MANativeAdView *)createNativeAdView
{
  UINib *nativeAdViewNib = [UINib nibWithNibName: @"NativeCustomAdView" bundle: NSBundle.mainBundle];
  MANativeAdView *nativeAdView = [nativeAdViewNib instantiateWithOwner: nil options: nil].firstObject;
  MANativeAdViewBinder *binder = [[MANativeAdViewBinder alloc] initWithBuilderBlock:^(MANativeAdViewBinderBuilder *builder) {
    builder.titleLabelTag = «title-label-tag»;
    builder.bodyLabelTag = «body-lable-tag»;
    builder.callToActionButtonTag = «call-to-action-label-tag»;
    builder.iconImageViewTag = «icon-image-view-taG»;
    builder.mediaContentViewTag = «media-view-content-view-tag»;
    builder.starRatingContentViewTag = «star-rating-content-view-tag»;
    builder.advertiserLabelTag = «advertiser-label-tag»;
    builder.optionsContentViewTag = «options-content-view-tag»;
  }];
  [nativeAdView bindViewsWithAdViewBinder: binder];
  return nativeAdView;
}

⋮

@end

각 네트워크의 가이드를 따르고 필수 광고 에셋을 바인딩하십시오. 그렇지 않으면 해당 네트워크에서 노출을 무효화할 수 있습니다.

Google bidding 및 Google AdMob/Google Ad Manager 추가 연동 단계

Google bidding 및 Google AdMob 어댑터 버전 9.11.0.6 및 Google Ad Manager 어댑터 버전 9.11.0.5부터 UI 컴포넌트를 바인딩하려면 다음 단계를 수행하십시오. 이를 통해 커스텀 네이티브 광고 뷰에서 연결되지 않은 뷰도 해당 네트워크에서 클릭할 수 있도록 보장합니다.

  1. 모든 광고 에셋을 포함하는 MANativeAdView 내부에 래퍼 뷰를 추가합니다. 해당 뷰의 Custom ClassGADNativeAdView로 설정합니다.

    NativeCustomAdView. Native Ad View. GAD Native Ad View. Custom Class: Class: GADNativeAdView. Module: None.

  2. 이 래퍼 뷰에 다른 뷰에서 사용하지 않는 고유한 Tag를 부여합니다.

    NativeCustomAdView. Native Ad View. GAD Native Ad View. View: Content Mode: Scale To Fill. Semantic: Unspecified. Tag: 1008. Interaction: ✅ User Interaction Enabled.

  3. 네이티브 광고 로더에 이 태그 값을 포함하는 로컬 추가 파라미터를 설정하고, 해당 키를 google_native_ad_view_tag로 지정합니다. 예를 들어, 뷰의 태그가 1008인 경우:

   -[setLocalExtraParameterForKey: "google_native_ad_view_tag" value: 1008]

네이티브 광고 로드

사전 렌더링된 광고 로드

사전 렌더링된 네이티브 광고를 로드하려면 광고 단위 ID에 해당하는 MANativeAdLoader를 인스턴스화하고 해당 loadAdIntoAdView 메서드를 호출하십시오. 네이티브 광고의 로드 상태가 변경될 때 알림을 받을 수 있도록 MANativeAdDelegate를 구현하고 설정하십시오.

광고 로드 및 렌더링 분리

네이티브 광고를 로드하려면 광고 단위 ID에 해당하는 MANativeAdLoader를 인스턴스화하고 해당 loadAd 메서드를 호출하십시오. 네이티브 광고의 로드 상태가 변경될 때 알림을 받을 수 있도록 MANativeAdDelegate를 구현하고 설정하십시오. 그런 다음 didLoadNativeAd:forAd:에서 반환된 MAAd를 사용하여 광고 뷰를 렌더링합니다. 이는 MANativeAdLoaderrenderNativeAdView:withAd: 메서드를 호출하여 수행할 수 있습니다.

네이티브 광고는 4시간의 광고 만료 시간 창 내에 노출해야 합니다. 이 시간 창을 벗어나 노출된 광고와 관련된 노출은 무효화됩니다.

네이티브 광고 제거

네이티브 광고를 더 이상 사용하지 않는 경우 해당 리소스를 제거하십시오. destroy() 메서드를 호출하여 제거할 수 있습니다. 그렇지 않으면 앱의 성능이 저하될 수 있습니다.

이전 단계에서 UI 컴포넌트를 바인딩한 후 네이티브 광고를 로드하고 제거하는 방법의 예시는 다음과 같습니다.

#import "ExampleViewController.h"
#import <AppLovinSDK/AppLovinSDK.h>

@interface ExampleViewController()<MANativeAdDelegate, MAAdRevenueDelegate>
@property (nonatomic, strong) UIView *nativeAdContainerView;
@property (nonatomic, strong) MANativeAdLoader *nativeAdLoader;
@property (nonatomic, strong) MAAd *loadedNativeAd;
@end

@implementation ExampleViewController

⋮

- (void)createNativeAdLoader
{
  self.nativeAdLoader = [[MANativeAdLoader alloc] initWithAdUnitIdentifier: @"«ad-unit-ID»"];
  self.nativeAdLoader.nativeAdDelegate = self;
  self.nativeAdLoader.revenueDelegate = self;
}

- (void)loadNativeAd
{
  [self.nativeAdLoader loadAdIntoAdView: [self createNativeAdView]];
}

- (void)didLoadNativeAd:(MANativeAdView *)nativeAdView forAd:(MAAd *)ad
{
  // Cleanup any pre-existing native ad to prevent memory leaks.
  if ( self.loadedNativeAd )
  {
    [self.nativeAdLoader destroyAd: self.loadedNativeAd];
  }

  // Save ad for cleanup.
  self.loadedNativeAd = ad;

  // Set to false if modifying constraints after adding the ad view to your layout
  self.nativeAdContainerView.translatesAutoresizingMaskIntoConstraints = NO;

  // Add the native ad view to your layout
  [self.nativeAdContainerView addSubview: nativeAdView];

  // Set ad view to span width and height of container and center the ad
  [self.nativeAdContainerView addConstraint: [NSLayoutConstraint constraintWithItem: nativeAdView attribute: NSLayoutAttributeWidth r elatedBy: NSLayoutRelationEqual toItem: self.nativeAdContainerView attribute: NSLayoutAttributeWidth multiplier: 1 constant: 0]];
  [self.nativeAdContainerView addConstraint: [NSLayoutConstraint constraintWithItem: nativeAdView attribute: NSLayoutAttributeHeight relatedBy: NSLayoutRelationEqual toItem: self.nativeAdContainerView attribute: NSLayoutAttributeHeight multiplier: 1 constant: 0]];
  [self.nativeAdContainerView addConstraint: [NSLayoutConstraint constraintWithItem: nativeAdView attribute: NSLayoutAttributeCenterX relatedBy: NSLayoutRelationEqual toItem: self.nativeAdContainerView attribute: NSLayoutAttributeCenterX multiplier: 1 constant: 0]];
  [self.nativeAdContainerView addConstraint: [NSLayoutConstraint constraintWithItem: nativeAdView attribute: NSLayoutAttributeCenterY relatedBy: NSLayoutRelationEqual toItem: self.nativeAdContainerView attribute: NSLayoutAttributeCenterY multiplier: 1 constant: 0]];
}

- (void)didFailToLoadNativeAdForAdUnitIdentifier:(NSString *)adUnitIdentifier withError:(MAError *)error
{
  // Native ad load failed
  // AppLovin recommends that you retry with exponentially higher delays up to a maximum delay
}

- (void)didClickNativeAd:(MAAd *)ad { }

- (void)didPayRevenueForAd:(MAAd *)ad { }

@end

에셋 크기

AppLovin Exchange 디맨드의 경우 Title, Description, CTA에 허용되는 최대 글자 수는 다음과 같습니다.

에셋최대 글자 수
Title50자
Description150자. 149자 뒤에 150번째 글자로 말줄임표()를 추가할 수 있습니다.
CTA15자

SDK 연동 네트워크의 경우, 해당 네트워크에서 최대 글자 수를 설정합니다.

미디어 콘텐츠 가로세로 비율을 가져오는 방법

다음 코드 스니펫은 네이티브 광고의 미디어 콘텐츠 가로세로 비율을 가져오는 방법을 보여줍니다.

- (void)didLoadNativeAd:(MANativeAdView *)nativeAdView forAd:(MAAd *)ad
{
  CGFloat aspectRatio = ad.nativeAd.mediaContentAspectRatio;
}

일부 네트워크는 미디어 콘텐츠 가로세로 비율을 제공하지 않으며, 이 경우 값은 0입니다.

별점

AppLovin MAX SDK를 사용하면 광고된 앱의 별점에 액세스하고 이를 렌더링할 수 있습니다. 제공되는 경우 값은 [0.0, 5.0] 범위의 부동 소수점 수입니다.

MAX SDK는 별점 컨테이너로 지정한 컨테이너 뷰에 별을 자동으로 렌더링합니다. 네트워크에서 별점을 제공하지 않거나 별점이 < 3인 경우, SDK는 별점 컨테이너 뷰를 채우지 않습니다. 개발자는 이에 맞게 레이아웃을 조정해야 합니다.

현재 광고의 별점을 가져오려면 다음을 수행하십시오.

- (void)didLoadNativeAd:(MANativeAdView *)nativeAdView forAd:(MAAd *)ad
{
  if ( ad.nativeAd.starRating < 3 )
  {
    // Star rating not available, or < 3 - hide star rating container view
    return;
  }

  // Star rating available and >= 3 - show star rating container view
}

Ad placer

Ad Placer는 UITableView 또는 UICollectionView를 사용하여 기존 콘텐츠 스트림에 네이티브 광고를 자동으로 삽입합니다. 이 API를 연동하려면 다음의 주요 단계를 수행하십시오.

  1. 네이티브 광고 레이아웃 구성.
  2. Ad placer 설정 생성.
  3. Ad placer 구성.
  4. 광고 렌더링 설정 구성.
  5. (선택 사항) 델리게이트 콜백 수신.

AppLovin 정책에 따라 광고에는 반드시 개인정보 보호 정보 아이콘이 포함되어야 합니다. 이 아이콘은 중요한 개인정보 처리방침 고지로 연결됩니다. -[MANativeAdViewBinderBuilder setOptionsContentViewTag:]를 통해 바인딩할 수 있습니다. 바인딩할 UI 컴포넌트를 포함하는 커스텀 뷰는 반드시 MANativeAdView를 상속해야 합니다.

1. 네이티브 광고 레이아웃 구성

Ad placer는 수동 네이티브 광고 레이아웃을 지원합니다. 광고 단위를 구성하는 방법은 위의 "Manual" 섹션을 참조하십시오. Ad placer가 레이아웃을 지원하도록 구성하는 방법은 아래의 광고 렌더링 설정 구성을 참조하십시오.

각 네트워크의 가이드를 따르고 필수 광고 에셋을 바인딩하십시오. 그렇지 않으면 해당 네트워크에서 노출을 무효화할 수 있습니다.

2. Ad placer 설정 생성

광고 단위 식별자를 사용하여 MAAdPlacerSettings 객체를 생성합니다. 이 객체는 Ad placer를 구성하고 피드 내 광고의 포지셔닝 정보를 제공합니다.

MAAdPlacerSettings *settings = [MAAdPlacerSettings settingsWithAdUnitIdentifier: @"«ad-unit-ID»"];

광고 포지션 구성

Ad placer는 피드에 광고를 배치합니다. 이는 최소한 다음 중 하나를 기반으로 수행됩니다.

  1. 광고를 배치할 위치를 나타내는 고정 인덱스 패스 목록
  2. 광고를 삽입할 반복 간격
    • Ad placer는 마지막 고정 포지션 이후에 반복 광고를 삽입합니다. 고정 포지션을 설정하지 않은 경우, Ad placer는 스트림의 첫 번째 포지션 이후에 반복 광고를 추가합니다. 이 간격 값은 2보다 크거나 같아야 합니다. 간격 값이 2 미만이면 Ad placer가 비활성화됩니다.

MAAdPlacerSettings를 수정하여 광고 포지션을 구성하십시오.

  1. 예를 들어 행 1에 새로운 고정 광고 포지션을 추가하려면 다음과 같이 하십시오.
   [settings addFixedPositions: [NSIndexPath indexPathForRow: 1 inSection: 0]];
  1. 기존 고정 포지션을 제거하려면 다음과 같이 하십시오.
   [settings resetFixedPositions];
  1. 반복 간격을 변경하려면(예: 피드의 매 5번째 포지션마다 광고를 삽입하려면) 다음과 같이 하십시오.
   settings.repeatingInterval = 5;

추가 설정

MAAdPlacerSettings에서 설정을 조정하여 Ad placer를 구성할 수 있습니다.

maximumAdCount
스트림의 최대 광고 수로 설정합니다(기본값=256). 스트림에 여러 섹션이 포함된 경우, 이는 광고 섹션당 최대 광고 수를 결정합니다.
maximumPreloadedAdCount
스트림에 배치하기 위해 프리로드할 최대 광고 수로 설정합니다(기본값=4).

3. Ad placer 구성

Ad placer를 구성할 때 다음 두 가지 옵션 중 하나를 선택하십시오.

  1. 피드가 UITableView를 기반으로 하는 경우 MATableViewAdPlacer를 사용합니다. UICollectionView를 기반으로 하는 경우 MACollectionViewAdPlacer를 사용합니다. 헬퍼 클래스는 기존 어댑터를 래핑하여 피드에 광고를 자동으로 렌더링하고 삽입합니다.

코드에서 UITableView/UICollectionView 프로퍼티 및 메서드 사용을 AppLovin의 카테고리 상응 항목으로 대체해야 합니다. 이들은 UITableView+MATableViewAdPlacer.h 또는 UICollectionView+MACollectionViewAdPlacer.h에 존재합니다. 이 메서드들은 삽입된 광고를 고려하여 인덱스 패스를 조정합니다. 또한 콘텐츠 변경 사항을 Ad placer에 알립니다.

  1. 피드가 다른 커스텀 UI 컴포넌트를 사용하는 경우, 구현에서 MAAdPlacer를 직접 사용하거나 상속하는 것을 선호할 수 있습니다.

MATableViewAdPlacer 사용하기

MATableViewAdPlacer로 Ad placer를 구성하려면 다음 지침을 따르십시오.

  1. 테이블 뷰 및 설정으로 MATableViewAdPlacer를 초기화합니다.
   self.adPlacer = [MATableViewAdPlacer placerWithTableView: self.tableView settings: settings];
  1. 다음 UITableView 프로퍼티 및 메서드를 AppLovin 카테고리 상응 항목(al_ 접두사 포함)으로 대체합니다.
    • dataSource
    • delegate
    • deleteRowsAtIndexPaths:withRowAnimation:
    • deleteSections:withRowAnimation:
    • dequeueReusableCellWithIdentifier:forIndexPath:
    • deselectRowAtIndexPath:animated:
    • endUpdates
    • indexPathForCell:
    • indexPathForRowAtPoint:
    • indexPathForSelectedRow
    • indexPathsForRowsInRect:
    • indexPathsForSelectedRows
    • indexPathsForVisibleRows
    • insertRowsAtIndexPaths:withRowAnimation:
    • insertSections:withRowAnimation:
    • moveRowsAtIndexPaths:withRowAnimation:
    • moveSections:withRowAnimation:
    • performBatchUpdates:completion:
    • rectForRowAtIndexPath:
    • reloadData
    • reloadRowsAtIndexPaths:withRowAnimation:
    • reloadSections:withRowAnimation:
    • scrollToRowAtIndexPath:atScrollPosition:animated:
    • selectRowAtIndexPath:animated:scrollPosition:
    • visibleCells
  2. loadAds를 호출하여 광고 로드를 시작합니다.

다음 코드는 MATableViewAdPlacer를 사용하여 테이블 뷰에 광고를 로드하는 방법을 보여줍니다.

- (void)viewDidLoad
{
  [super viewDidLoad];

  // Configure table view
  self.tableView.al_delegate = self;
  self.tableView.al_dataSource = self;

  // Configure ad placer and load ads
  MAAdPlacerSettings *settings = [MAAdPlacerSettings settingsWithAdUnitIdentifier: @"«ad-unit-ID»"];
  self.adPlacer = [MATableViewAdPlacer placerWithTableView: self.tableView settings: settings];
  self.adPlacer.delegate = self;
  [self.adPlacer loadAds];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
  return self.data.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  UITableViewCell *cell = [tableView al_dequeueReusableCellWithIdentifier: @"YourCell" forIndexPath: indexPath];
  cell.textLabel.text = self.data[indexPath.row];
  return cell;
}

MACollectionViewAdPlacer 사용하기

MACollectionViewAdPlacer로 Ad placer를 구성하려면 다음 지침을 따르십시오.

  1. 테이블 뷰 및 설정으로 MACollectionViewAdPlacer를 초기화합니다.
   self.adPlacer = [MACollectionViewAdPlacer placerWithCollectionView: self.collectionView settings: settings];
  1. 다음 UITableView 프로퍼티 및 메서드를 AppLovin 카테고리 상응 항목(al_ 접두사 포함)으로 대체합니다.
    • cellForItemAtIndexPath:
    • dataSource
    • delegate
    • deleteItemsAtIndexPaths:
    • deleteSections:
    • dequeueReusableCellWithIdentifier:forIndexPath:
    • deselectItemAtIndexPath:animated:
    • indexPathForCell:
    • indexPathForItemAtPoint:
    • indexPathsForSelectedItems
    • indexPathsForVisibleItems
    • insertItemsAtIndexPaths:
    • insertSections:
    • layoutAttributesForItemAtIndexPath:
    • moveItemsAtIndexPaths:
    • moveSections:
    • performBatchUpdates:completion:
    • reloadData
    • reloadItemsAtIndexPaths:
    • reloadSections:
    • scrollToItemAtIndexPath:atScrollPosition:animated:
    • selectedItemAtIndexPath:animated:scrollPosition:
    • visibleCells
  2. 컬렉션 뷰에 스토리보드를 사용하는 경우, 컬렉션 뷰의 "Estimate Size" 프로퍼티를 "None"으로 설정합니다.
  3. loadAds를 호출하여 광고 로드를 시작합니다.

다음 코드는 MACollectionViewAdPlacer를 사용하여 테이블 뷰에 광고를 로드하는 방법을 보여줍니다.

- (void)viewDidLoad
{
  [super viewDidLoad];

  // Configure collection view
  self.collectionView.al_delegate = self;
  self.collectionView.al_dataSource = self;

  // Configure ad placer and load ads
  MAAdPlacerSettings *settings = [MAAdPlacerSettings settingsWithAdUnitIdentifier: @"«ad-unit-ID»"];
  self.adPlacer = [MACollectionViewAdPlacer placerWithCollectionView: self.collectionView settings: settings];
  self.adPlacer.delegate = self;
  [self.adPlacer loadAds];
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
  return self.data.count;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
  MyCollectionViewCell *cell = (MyCollectionViewCell *)[collectionView al_dequeueReusableCellWithIdentifier: @"YourCell" forIndexPath: indexPath];
  cell.textLabel.text = self.data[indexPath.row];
  return cell;
}

4. 광고 렌더링 설정 구성

광고를 로드하기 전에 Ad placer에서 nativeAdViewNibnativeAdViewBinder 프로퍼티를 설정하십시오. AppLovin은 adSize 프로퍼티도 설정할 것을 권장합니다. 이를 통해 렌더링을 최적화할 수 있습니다.

5. 선택 사항으로 델리게이트 콜백 수신

모든 Ad placer에는 이벤트를 알릴 수 있는 선택적 델리게이트 콜백이 포함되어 있습니다.

  • didLoadAdAtIndexPath:
  • didRemoveAdsAtIndexPaths:
  • didClickAd:
  • didPayRevenueForAd:

search