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 를 추가하여 제공해줍니다.)

Last updated

Was this helpful?