사용자는 '이 광고 끄기' 기능을 통해 광고를 닫거나 광고가 표시되지 않게 하여 관심이 없는 광고임을 알릴 수 있습니다. 기본 버전은 다음과 같습니다(맞춤 버전 아님).
GADUnifiedNativeAd
를 이용하면
사용자가 네이티브 광고를 끌 수 있도록 자체 UI를
구현할 수 있습니다. 구현 방법은 다음과 같습니다.
맞춤 '이 광고 끄기' 요청
먼저 GADNativeMuteThisAdLoaderOptions
클래스를 사용하여 맞춤 '이 광고 끄기' 기능을
요청하세요.
Swift
adLoader = GADAdLoader(adUnitID: "[AD_UNIT_ID]", rootViewController: self, adTypes: [ .unifiedNative ], options: [GADNativeMuteThisAdLoaderOptions()]) adLoader.delegate = self adLoader.load(GADRequest())
Objective-C
GADNativeMuteThisAdLoaderOptions *muteOptions = [GADNativeMuteThisAdLoaderOptions new]; self.adLoader = [[GADAdLoader alloc] initWithAdUnitID:"[AD_UNIT_ID]" rootViewController:self adTypes:@[ kGADAdLoaderAdTypeUnifiedNative ] options:@[ muteOptions ]]; self.adLoader.delegate = self; [self.adLoader loadRequest:[GADRequest request]];
맞춤 '이 광고 끄기'를 사용할 수 있는지 확인
네이티브 광고가 로드되면
네이티브 광고에서 isCustomMuteThisAdAvailable
속성을 확인하세요. 사용 가능한 경우 맞춤 버튼이 표시됩니다.
Swift
func adLoader(_ adLoader: GADAdLoader, didReceive nativeAd: GADUnifiedNativeAd){ nativeAdView.nativeAd = nativeAd if (nativeAd.isCustomMuteThisAdAvailable) { enableCustomMute(nativeAd.muteThisAdReasons) } else { hideCustomMute() } ... } func enableCustomMute(_ reasons:[GADMMuteThisAdReason]) { // TODO: This method should show your custom mute button and provide the list // of reasons to the interface that are to be displayed when the user mutes // the ad. } func hideCustomMute() { //TODO: Remove / hide the custom mute button from your user interface. }
Objective-C
- (void)adLoader:(GADAdLoader *)adLoader didReceiveUnifiedNativeAd: (GADUnifiedNativeAd *)nativeAd { self.nativeAdView.nativeAd = nativeAd; if (nativeAd.isCustomMuteThisAdAvailable) { [self enableCustomMuteWithReasons:nativeAd.muteThisAdReasons]; } else { [self hideCustomMute]; } } - (void)enableCustomMuteWithReasons:(NSArray<GADMuteThisAdReason *> *)reasons { // TODO: This method should show your custom mute button and provide the list // of reasons to the interface that are to be displayed when the user mutes the // ad. } - (void)hideCustomMute { // TODO: Remove / hide the custom mute button from your user interface. }
맞춤 광고 끄기 인터페이스의 구현은 게시자가 정합니다. 광고에 작은 닫기 버튼을 넣거나, 사용자가 광고 끄기를 선택할 수 있는 다른 인터페이스를 제공할 수 있습니다.
'이 광고 끄기' 이유 표시
맞춤 '이 광고 끄기'를 사용할 수 있으면 네이티브 광고에 있는 muteThisAdReason
의
속성에서 일련의 GADMuteThisAdReason
객체를
사용할 수 있습니다. GADMuteThisAdReason에는
표시 가능한 문자열이
제공되는 reasonDescription 속성이 있습니다.
이러한 이유를 사용자에게 표시하고 사용자가 광고를 끄는 이유를 선택하도록 제공하는 것이 좋습니다. 사용자가 이유 중 하나를 클릭하면 선택한 이유와 함께 광고 끄기를 보고해야 합니다.
사용자가 닫기 버튼을 클릭할 때 이러한 이유를 표시하지 않고 바로 광고 끄기를 보고할 수도 있습니다.
광고 끄기
광고를 끄려면 두 가지 작업이 필요합니다.
- 광고 끄기의 이유를 네이티브 광고에 보고하세요.
- 사용자 인터페이스에서 원하는 방식으로 직접 광고를 끄거나 숨기세요.
Swift
func muteAdDialogDidSelect(reason: GADMuteThisAdReason) { // Report the mute action and reason to the ad. nativeAdView.nativeAd?.muteThisAd(with: reason) muteAd() } func muteAd() { // TODO: Mute / hide the ad in your preferred manner. }
Objective-C
- (void)muteAdDialogDidSelectReason:(GADMuteThisAdReason *)reason { // Report the mute action and reason to the ad. [self.nativeAdView.nativeAd muteThisAdWithReason:reason]; [self muteAd]; } - (void)muteAd { // TODO: Mute / hide the ad in your preferred manner. }
광고 끄기 확인 받기(선택사항)
광고 끄기에 성공했다는 보고를 받으려면
GADUnifiedNativeAdDelegate
메서드인
nativeAdIsMuted:
를
구현하세요.
이 메서드는 광고가 제대로 꺼진 경우에만 호출됩니다.