Native Special Ad
This is a settings guide for Special Ad (= RichMedia) products provided by Naver (NDP).

Adding Dependencies
To use Rich Media ads, the following dependencies must be added to your Podfile.
The GFPSDK Core module along with the NDA, NDAVideo, and NDARich modules are required.
#When using static library
pod 'GFPSDK' # SDK Core
pod 'GFPSDK/MediationNDA' # Naver Banner/Native Ads
pod 'GFPSDK/MediationNDAVideo' # Naver Video Ad (since 4.3.0)
pod 'GFPSDK/MediationNDARich' # Naver Premium Ad (since 4.3.0)
#When using dynamic library
pod 'GFPSDK-Dynamic' # SDK Core
pod 'GFPSDK-Dynamic/MediationNDA' # Naver Banner/Native Ads
pod 'GFPSDK-Dynamic/MediationNDAVideo' # Naver Video Ad (since 4.3.0)
pod 'GFPSDK-Dynamic/MediationNDARich' # Naver Premium Ad (since 4.3.0)
Loader Configuration
Rich Media products are provided in the form of NativeSimple (aka. NS).
Please refer to the NS guide to configure the ad loader.
Additional GFPNativeSimpleAdDelegate Implementation
Unlike regular NS, Rich Media products have a vertical expand/collapse feature, so an ad view size change event is sent to the service when expanding or collapsing.
The service can apply the change by adjusting the ad view using the size value received from the corresponding delegate.
- Swift
- Objective-C
func nativeSimpleAd(_ nativeSimpleAd: GFPNativeSimpleAd, didChangeRichAdSizeWith size: CGSize) {
// ...
}
- (void)nativeSimpleAd:(GFPNativeSimpleAd *)nativeSimpleAd didChangeRichAdSizeWith:(CGSize)size {
// ...
}
Starting from version 7.5.2, delegates have been added to notify the start and end of expand/collapse.
- Swift
- Objective-C
func nativeSimpleRichAdExtendComplete(_ nativeSimpleAd: GFPNativeSimpleAd) {
// Expand complete
}
func nativeSimpleRichAdExtendStart(_ nativeSimpleAd: GFPNativeSimpleAd, toSize size: CGSize) {
// Expand started, final expanded size delivered
}
func nativeSimpleRichAdShrinkComplete(_ nativeSimpleAd: GFPNativeSimpleAd) {
// Collapse complete
}
func nativeSimpleRichAdShrinkStart(_ nativeSimpleAd: GFPNativeSimpleAd, toSize size: CGSize) {
// Collapse started, final collapsed size delivered
}
- (void)nativeSimpleRichAdExtendComplete:(GFPNativeSimpleAd *)nativeSimpleAd {
// Expand complete
}
- (void)nativeSimpleRichAdExtendStart:(GFPNativeSimpleAd *)nativeSimpleAd toSize:(CGSize)size {
// Expand started, final expanded size delivered
}
- (void)nativeSimpleRichAdShrinkComplete:(GFPNativeSimpleAd *)nativeSimpleAd {
// Collapse complete
}
- (void)nativeSimpleRichAdShrinkStart:(GFPNativeSimpleAd *)nativeSimpleAd toSize:(CGSize)size {
// Collapse started, final collapsed size delivered
}
Special DA Minimum Exposure Height
Returns the minimum visible area height that the service must guarantee for Special DA Double Crown and Triple Crown ads.
- Swift
- Objective-C
func minimumSpecialDaRegionHeight() -> CGFloat {
return 100
}
- (CGFloat)minimumSpecialDaRegionHeight {
return 100;
}
GFPNativeVideoEventDelegate
To receive rich ad video playback state changes, implement GFPNativeVideoEventDelegate and register it on the videoEventDelegate property of GFPNativeSimpleAdRenderingSetting.
- Swift
- Objective-C
nativeSimpleOptions.simpleAdRenderingSetting.videoEventDelegate = self
nativeSimpleOptions.simpleAdRenderingSetting.videoEventDelegate = self;
- Swift
- Objective-C
func nativeAd(_ nativeAd: NSObject, richVideoWillPlayWith isMuted: Bool) {
// Just before video playback
}
func nativeAd(_ nativeAd: NSObject, richVideoDidPlayWith isMuted: Bool) {
// State change after video playback starts
}
func nativeAd(_ nativeAd: NSObject, richVideoWillStopWith isMuted: Bool) {
// Just before video stops
}
func nativeAd(_ nativeAd: NSObject, richVideoDidStopWith isMuted: Bool) {
// State change after video stops
}
func nativeAd(_ nativeAd: NSObject, richVideoMuteChanged isMuted: Bool) {
// Mute state changed
}
- (void)nativeAd:(NSObject *)nativeAd richVideoWillPlayWith:(BOOL)isMuted {
// Just before video playback
}
- (void)nativeAd:(NSObject *)nativeAd richVideoDidPlayWith:(BOOL)isMuted {
// State change after video playback starts
}
- (void)nativeAd:(NSObject *)nativeAd richVideoWillStopWith:(BOOL)isMuted {
// Just before video stops (not called when memory is released)
}
- (void)nativeAd:(NSObject *)nativeAd richVideoDidStopWith:(BOOL)isMuted {
// State change after video stops or when memory is released
}
- (void)nativeAd:(NSObject *)nativeAd richVideoMuteChanged:(BOOL)isMuted {
// Mute state changed
}
Limiting Maximum Expand Height for Expandable Ads
Applies to certain ad products released after the Special DA Premium "New" Video Expandable type that provides 9:16, 16:9, and 1:1 ratio videos.
maxExtendingHeight is set as a block and can be dynamically changed even after an ad is loaded.
Setting it to 0 or below removes the height restriction.
- Swift
- Objective-C
let nativeSimpleOptions = GFPAdNativeSimpleOptions()
nativeSimpleOptions.simpleAdRenderingSetting = GFPNativeSimpleAdRenderingSetting()
nativeSimpleOptions.simpleAdRenderingSetting.maxExtendingHeight = { 50 }
self.adLoader?.setNativeSimpleDelegate(self, nativeSimpleOptions: nativeSimpleOptions)
GFPAdNativeSimpleOptions *nativeSimpleOptions = [[GFPAdNativeSimpleOptions alloc] init];
nativeSimpleOptions.simpleAdRenderingSetting = [[GFPNativeSimpleAdRenderingSetting alloc] init];
nativeSimpleOptions.simpleAdRenderingSetting.maxExtendingHeight = ^CGFloat { return 50; };
[self.adLoader setNativeSimpleDelegate:self nativeSimpleOptions:nativeSimpleOptions];
Querying the Aspect Ratio of Expandable Ad Media
Applies to certain ad products released after the Special DA Premium "New" Video Expandable type that provides 9:16, 16:9, and 1:1 ratio videos.
- Swift
- Objective-C
func adLoader(_ adLoader: GFPAdLoader, didReceive nativeSimpleAd: GFPNativeSimpleAd) {
let mediaSize = nativeSimpleAd.mediaData?.richMediaData?.extendMediaSize
let ratioType = nativeSimpleAd.mediaData?.richMediaData?.extendMediaAspectRatioType
// GFPRichExtendMediaRatioTypeOther
// GFPRichExtendMediaRatioType1_1
// GFPRichExtendMediaRatioType9_16
// GFPRichExtendMediaRatioType16_9
}
- (void)adLoader:(GFPAdLoader *)adLoader didReceiveNativeSimpleAd:(GFPNativeSimpleAd *)nativeSimpleAd {
CGSize mediaSize = nativeSimpleAd.mediaData.richMediaData.extendMediaSize;
GFPRichExtendMediaRatioType ratioType = nativeSimpleAd.mediaData.richMediaData.extendMediaAspectRatioType;
/**
* GFPRichExtendMediaRatioTypeOther
* GFPRichExtendMediaRatioType1_1
* GFPRichExtendMediaRatioType9_16
* GFPRichExtendMediaRatioType16_9
*/
}
Parallel Configuration with Standard Format
The default height for Rich Media is 140.
Rich Media products are provided as a combination of Rich Media products and regular image-type ads.
When the service cannot dynamically adjust the ad vertical area depending on whether the ad is an image type or a Rich Media product,
e.g., when a fixed size must be maintained regardless of image type / rich type at the start of an ad,
there is an isImageSizePreferred setting that arranges image-type ads centered at the bottom-right, prioritizing the image size regardless of the ad area.
- Swift
- Objective-C
let simpleSetting = GFPNativeSimpleAdRenderingSetting()
simpleSetting.preferredAdChoicesViewPosition = .topRightCorner
simpleSetting.isImageSizePreferred = true
let nativeSimpleOptions = GFPAdNativeSimpleOptions()
nativeSimpleOptions.simpleAdRenderingSetting = simpleSetting
// ...
self.adLoader?.setNativeSimpleDelegate(self, nativeSimpleOptions: nativeSimpleOptions)
GFPNativeSimpleAdRenderingSetting *simpleSetting = [[GFPNativeSimpleAdRenderingSetting alloc] init];
simpleSetting.preferredAdChoicesViewPosition = GFPAdChoicesViewPositionTopRightCorner;
simpleSetting.isImageSizePreferred = YES;
GFPAdNativeSimpleOptions *nativeSimpleOptions = [[GFPAdNativeSimpleOptions alloc] init];
nativeSimpleOptions.simpleAdRenderingSetting = simpleSetting;
// ...
[self.adLoader setNativeSimpleDelegate:self nativeSimpleOptions:nativeSimpleOptions];
If a flexible response is possible, you can handle it using the following method of GFPNativeSimpleAdDelegate.
- Swift
- Objective-C
func nativeSimpleAd(_ nativeSimpleAd: GFPNativeSimpleAd, didChangeMediaViewSizeWith size: CGSize) {
// ...
}
- (void)nativeSimpleAd:(GFPNativeSimpleAd *)nativeSimpleAd didChangeMediaViewSizeWith:(CGSize)size {
// ...
}
Triple Crown / Double Crown Background View Configuration
Triple Crown and Double Crown ads use a background view and an object view from the service's surface behind the ad view.
Add them to the view hierarchy in advance, then pass them to GFPNativeSimpleAdView's additionalRenderingViewDict using the keys below.
| Key Constant | Purpose |
|---|---|
kTripleCrownBgView | Triple Crown background view (background video is inserted) |
kTripleCrownTopObjectView | Triple Crown top object view (ad logo is inserted) |
kDoubleCrownBgView | Double Crown background view (background video is inserted) |
additionalRenderingViewDict must be set before setting nativeSimpleAdView.nativeAd.
If both kTripleCrownBgView and kTripleCrownTopObjectView are not provided for Triple Crown, the SDK automatically renders a fallback ad format.
- Swift
- Objective-C
// 1. 배경 뷰들을 뷰 계층에 추가
let tripleCrownBGView = UIView(frame: CGRect(x: 0, y: 0, width: view.bounds.width, height: 400))
tripleCrownBGView.isUserInteractionEnabled = true
scrollView.addSubview(tripleCrownBGView)
let doubleCrownBGView = UIView(frame: CGRect(x: 0, y: 0, width: view.bounds.width, height: 300))
doubleCrownBGView.isUserInteractionEnabled = true
scrollView.addSubview(doubleCrownBGView)
let tripleCrownObjectView = UIView(frame: CGRect(x: 0, y: 0, width: view.bounds.width, height: 200))
tripleCrownObjectView.isUserInteractionEnabled = true
scrollView.addSubview(tripleCrownObjectView)
// 2. nativeAd 설정 전에 additionalRenderingViewDict 전달
nativeSimpleAdView.additionalRenderingViewDict = [
kTripleCrownBgView as String: tripleCrownBGView,
kTripleCrownTopObjectView as String: tripleCrownObjectView,
kDoubleCrownBgView as String: doubleCrownBGView
]
nativeSimpleAdView.nativeAd = nativeSimpleAd
// 1. 배경 뷰들을 뷰 계층에 추가
self.tripleCrownBGView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 400)];
self.tripleCrownBGView.userInteractionEnabled = YES;
[scrollView addSubview:self.tripleCrownBGView];
self.doubleCrownBGView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 300)];
self.doubleCrownBGView.userInteractionEnabled = YES;
[scrollView addSubview:self.doubleCrownBGView];
self.tripleCrownObjectView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 200)];
self.tripleCrownObjectView.userInteractionEnabled = YES;
[scrollView addSubview:self.tripleCrownObjectView];
// 2. nativeAd 설정 전에 additionalRenderingViewDict 전달
self.nativeSimpleAdView.additionalRenderingViewDict = @{
kTripleCrownBgView: self.tripleCrownBGView,
kTripleCrownTopObjectView: self.tripleCrownObjectView,
kDoubleCrownBgView: self.doubleCrownBGView
};
self.nativeSimpleAdView.nativeAd = nativeSimpleAd;
Checking the Ad Type
To check whether the received ad is Triple Crown or Double Crown, use the kGFPMediaViewType key in nativeSimpleAd.assets.extraInfo.
- Swift
- Objective-C
let mediaType = nativeSimpleAd.assets?.extraInfo?[kGFPMediaViewType] as? NSNumber
if mediaType?.intValue == GFPExternalMediaViewType.tripleCrown.rawValue {
// Triple Crown ad
} else if mediaType?.intValue == GFPExternalMediaViewType.doubleCrown.rawValue {
// Double Crown ad
}
NSNumber *mediaType = nativeSimpleAd.assets.extraInfo[kGFPMediaViewType];
if (mediaType.intValue == GFPExternalMediaViewTypeTripleCrown) {
// Triple Crown ad
} else if (mediaType.intValue == GFPExternalMediaViewTypeDoubleCrown) {
// Double Crown ad
}
Retrieving Triple Crown Special Logo Information
Special logo information for Triple Crown ads (e.g., for changing logo color) is provided as a JSON string.
Retrieve it using the kGFPNaverAppLogoInfoKey key.
- Swift
- Objective-C
let logoJsonString = nativeSimpleAd.assets?.extraInfo?[kGFPNaverAppLogoInfoKey] as? String
NSString *logoJsonString = nativeSimpleAd.assets.extraInfo[kGFPNaverAppLogoInfoKey];
Special DA Bottom-Only Expand Configuration
By default, Special DA uses an expansion method that includes a top margin.
To expand only downward without a top margin, set enableSpecialDABottomExtend.
- Swift
- Objective-C
let simpleSetting = GFPNativeSimpleAdRenderingSetting()
simpleSetting.enableSpecialDABottomExtend = true
GFPNativeSimpleAdRenderingSetting *simpleSetting = [[GFPNativeSimpleAdRenderingSetting alloc] init];
simpleSetting.enableSpecialDABottomExtend = YES;
Special DA Layout Configuration
Options used to adjust the detailed layout of Special DA ads.
| Property | Type | Description |
|---|---|---|
specialDAOverlayHeight | CGFloat | Height value for overlap with the widget surface |
specialDAAdditionalMargin | CGFloat | Additional widget margin value |
specialDAGradientHeight | CGFloat | Gradient height at the bottom of the ad |
v1Gradient | BOOL | Whether to use the v1 gradient at the bottom of the MediaView |
- Swift
- Objective-C
let simpleSetting = GFPNativeSimpleAdRenderingSetting()
simpleSetting.specialDAOverlayHeight = 44
simpleSetting.specialDAAdditionalMargin = 8
simpleSetting.specialDAGradientHeight = 60
simpleSetting.v1Gradient = true
GFPNativeSimpleAdRenderingSetting *simpleSetting = [[GFPNativeSimpleAdRenderingSetting alloc] init];
simpleSetting.specialDAOverlayHeight = 44;
simpleSetting.specialDAAdditionalMargin = 8;
simpleSetting.specialDAGradientHeight = 60;
simpleSetting.v1Gradient = YES;