NAM (Naver Ad Manager)

NAM (Naver Ad Manager)

사용방법

1) 설치

미디에이션

2) 초기 셋팅

ATS(App Transport Security) 설정 -> 링크

iOS 9부터 도입 된 App Transport Security (ATS)는 앱이 HTTPS를 통해서만 네트워크 요청을 하도록 기본설정 되어있습니다. HTTP를 사용하는 광고파트너들의 광고동작를 허용하기 위해, Info.plist 파일에 아래내용을 추가합니다.

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

3) 초기화

GFPAdManagerDelegate 설정 -> 링크

NAM SDK에 ATTFramework를 통해 서비스에서 광고 추적 여부를 구현 후, GFPAdManagerDelegate를 통하여 Status를 SDK에 제공해줘야 합니다. 이에 아래 예시와 같이 초기화 API 및 Status를 제공해 주시기 바랍니다.

@import GFPSDK;
@interface AppDelegate() <APSSPSDKInitializeDelegate, GFPAdManagerDelegate>
@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    GFPAdConfiguration *configuration = [[GFPAdConfiguration alloc] init];
    [GFPAdManager setupWithPublisherCd:@"NAM_Publisher_cd" target:self configuration:configuration completionHandler:^(GFPError * _Nullable error) {
        NSLog(@"NAM Setup ERROR: %@", error);
    }];

}

- (GFPATTAuthorizationStatus)attStatus {
     if (@available(iOS 14.5, *)) {
        return ATTrackingManager.trackingAuthorizationStatus;
    } else {
        if ([[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]) {
            return GFPATTAuthorizationStatusAuthorized;
        }
        
        return GFPATTAuthorizationStatusNotDetermined;
    }
}


Native Layout 설정

  • 스토리보드에 UIView 생성 후 Custom Class을 AdPopcornSSPNativeAd 설정

  • AdPopcornSSPNativeAd 변수 내부에 GfpNativeAdView, GfpNativeSimpleAdView를 포함할 수 있도록 adAMNativeSuperView 라는 UIView 를 생성, 추가해 줍니다. (중요!)

NAM 은 ViewController에 ui component 영역을 바로 생성하지 않고 xib 파일을 사용하여 view를 add합니다.

GfpNativeSimpleAdView -> 따로 커스텀 하실 필요 없습니다. GfpNativeAdView -> 해당 xib 를 커스텀 하여 사용하시면 됩니다 (mediaView, BodyLabel 필수!) NAM 참조 링크

1) GFPNativeAdView


#import <AdPopcornSSP/AdPopcornSSPNativeAd.h>	
#import "NAMAdapter.h"

- (void)viewDidLoad {
    [super viewDidLoad];  
    // Size
    CGFloat width = [UIScreen mainScreen].bounds.size.width;
    CGFloat xibHeight = (width * 185) / 360;
    NSLog(@"width : %f, xibHeight : %f",width, xibHeight);
    CGFloat roundXibHeight = round(xibHeight * 10 )/ 10;
    NSLog(@"width : %f, height : %f",width, roundXibHeight);
    
    // 일반형
    GFPNativeAdView *namNativeAdView =
    [[NSBundle mainBundle] loadNibNamed:@"GFPNativeAdView" owner:nil options:nil].firstObject;
    namNativeAdView.frame = CGRectMake(0, 0, width, roundXibHeight);
    apNAMNativeAdRenderer.namNativeAdView = namNativeAdView;
    
    // 일반형을 담을 SuperView
    apNAMNativeAdRenderer.namNativeSuperView = adNAMNativeSuperView;
    
    [_adPopcornSSPNativeAd setNAMRenderer:apNAMNativeAdRenderer superView:_adNAMNativeSuperView];   // SuperView
}    

NAM의 경우 AdPopcornSSP, FAN, FAN Native Banner와 다르게 xib파일을 이용하여 직접 View를 생성한 뒤, 해당 xib 파일을 읽어와 renderer에 전달해 주어야 합니다.

APNAMNativeAdRenderer에 GFPNativeAdView와 superView를 세팅 후, setNAMRenderer:superView:API를 통해 render와 adNAMNativeSuperView 를 sdk에 최종적으로 전달합니다.

(adNAMNativeSuperView 를 render 설정시 넘겨 주면 SDK내부 코드에서 광고에 맞게 nativeAd, NativeSimpIeAd 를 추가하여 제공해줍니다.)

2) GFPNativeSimpleAdView

#import <AdPopcornSSP/AdPopcornSSPNativeAd.h>	
#import "NAMAdapter.h"

- (void)viewDidLoad {
    [super viewDidLoad];  
    // Size
    CGFloat width = [UIScreen mainScreen].bounds.size.width;
    CGFloat xibHeight = (width * 185) / 360;
    NSLog(@"width : %f, xibHeight : %f",width, xibHeight);
    CGFloat roundXibHeight = round(xibHeight * 10 )/ 10;
    NSLog(@"width : %f, height : %f",width, roundXibHeight);
    
    // 일반형
    GFPNativeSimpleAdView *namNativeSimpleAdView =
    [[NSBundle mainBundle] loadNibNamed:@"GFPNativeSimpleAdView" owner:nil options:nil].firstObject;

    namNativeSimpleAdView.frame = CGRectMake(0, 0, width, roundXibHeight);
    apNAMNativeAdRenderer.namNativeSimpleAdView = namNativeSimpleAdView;
    
    // 일반형을 담을 SuperView
    apNAMNativeAdRenderer.namNativeSuperView = adNAMNativeSuperView;
    
    [_adPopcornSSPNativeAd setNAMRenderer:apNAMNativeAdRenderer superView:_adNAMNativeSuperView];   // SuperView
}    

NAM의 경우 AdPopcornSSP, FAN, FAN Native Banner와 다르게 xib파일을 이용하여 직접 View를 생성한 뒤, 해당 xib 파일을 읽어와 renderer에 전달해 주어야 합니다.

APNAMNativeAdRenderer에 GFPNativeAdView와 superView를 세팅 후, setNAMRenderer:superView:API를 통해 render와 adNAMNativeSuperView 를 sdk에 최종적으로 전달합니다.

(adNAMNativeSuperView 를 render 설정시 넘겨 주면 SDK내부 코드에서 광고에 맞게 nativeAd, NativeSimpIeAd 를 추가하여 제공해줍니다.)

3) GFPNativeAdView + GFPNativeSimpleAdView

#import <AdPopcornSSP/AdPopcornSSPNativeAd.h>	
#import "NAMAdapter.h"

- (void)viewDidLoad {
    [super viewDidLoad];  
    // Size
    CGFloat width = [UIScreen mainScreen].bounds.size.width;
    CGFloat xibHeight = (width * 185) / 360;
    NSLog(@"width : %f, xibHeight : %f",width, xibHeight);
    CGFloat roundXibHeight = round(xibHeight * 10 )/ 10;
    NSLog(@"width : %f, height : %f",width, roundXibHeight);

    // 심플형
    GFPNativeSimpleAdView *namNativeSimpleAdView =
    [[NSBundle mainBundle] loadNibNamed:@"GFPNativeSimpleAdView" owner:nil options:nil].firstObject;
    namNativeSimpleAdView.frame = CGRectMake(0, 0, width, roundXibHeight);
    APNAMNativeAdRenderer *apNAMNativeAdRenderer = [[APNAMNativeAdRenderer alloc] init];
    apNAMNativeAdRenderer.namNativeSimpleAdView = namNativeSimpleAdView;
    
    // 일반형
    GFPNativeAdView *namNativeAdView =
    [[NSBundle mainBundle] loadNibNamed:@"GFPNativeAdView" owner:nil options:nil].firstObject;
    namNativeAdView.frame = CGRectMake(0, 0, width, roundXibHeight);
    apNAMNativeAdRenderer.namNativeAdView = namNativeAdView;
    
    // 심플형 + 일반형을 담을 SuperView
    apNAMNativeAdRenderer.namNativeSuperView = adNAMNativeSuperView;
    
    [_adPopcornSSPNativeAd setNAMRenderer:apNAMNativeAdRenderer superView:_adNAMNativeSuperView];   // SuperView
}

NAM의 경우 AdPopcornSSP, FAN, FAN Native Banner와 다르게 xib파일을 이용하여 직접 View를 생성한 뒤, 해당 xib 파일을 읽어와 renderer에 전달해 주어야 합니다.

APNAMNativeAdRenderer에 GFPNativeAdView와 superView를 세팅 후, setNAMRenderer:superView:API를 통해 render와 adNAMNativeSuperView 를 sdk에 최종적으로 전달합니다.

(adNAMNativeSuperView 를 render 설정시 넘겨 주면 SDK내부 코드에서 광고에 맞게 nativeAd, NativeSimpIeAd 를 추가하여 제공해줍니다.)

GFPNativeAdView

component 별로 사용되어야 하는 타입은 아래와 같습니다.

  • 필수

    • advertiserLabel : UILabel

    • bodyLabel : UILabel

    • mediaView : GFPMediaView

    • adChoicesView : UIView

  • 옵션

    • iconView : UIImageView

    • titleLabel : UILabel

    • callToActionLabel : UILabel

    • socialContextLabel : UILabel

네이티브 광고 중복 제어 설정

네이티브 광고에 대해서는 여러 지면에 중복된 광고가 노출되는것을 방지하기 위해 아래의 옵션을 제공합니다. apNAMNativeAdRenderer에 아래의 설정을 추가해 주면 동일한 GFPAdDedupeManager를 사용하는 지면은 중복된 광고가 노출되지 않습니다.(참고 : NAM 중복 제어 가이드)

// NAM 광고 중복처리용 dedupeManager
GFPAdDedupeManager *dedupeManager = [[GFPAdDedupeManager alloc] initWithNumAdsDeduped:3];
    
// 위 render 연동
apNAMNativeAdRenderer.namDedupeManager = dedupeManager; 

위와 같이 설정된 경우 dedupeManager를 render에 연결해준 지면에서 NAM의 광고는 중복된 광고가 노출되지 않습니다. 만약 다른 지면에서는 중복을 허용하고자 할 경우에는 GfpDedupeManager를 새로 생성하거나, 세팅하지 않으면 됩니다.

Last updated

Was this helpful?