Parental gate
You can optionally add the AwesomeAds Parental gate to an ad placement. The Parental gate is a dialog that appears when a user clicks on an ad. It is designed to prevent very young users from clicking on an ad without their parent’s assistance.
When the user clicks on the ad, the Parental gate dialog is displayed. It presents a math challenge which the user must solve to proceed to the ad.
The Parental gate is disabled by default. To use the Parental gate, see the following code and examples.
Enable/disable the Parental gate
IMPORTANT:
A parental gate is mandatory on all external click-throughs on apps in the Kids category. If your app is in the Kids category, and you do not have your own parental gate, apply the AwesomeAds Parental gate to prevent your app from being blocked by Apple.
- To enable the Parental gate on one banner ad:
myBanner.enableParentalGate()
or
myBanner.setParentalGate(true)
- To disable the Parental gate on one banner ad:
myBanner.disableParentalGate()
or
myBanner.setParentalGate(false)
- To enable the Parental gate on all interstitial ads:
InterstitialAd.enableParentalGate()
or
InterstitialAd.setParentalGate(true)
- To disable the Parental gate on all video ads:
VideoAd.disableParentalGate()
or
VideoAd.setParentalGate(false)
- To enable the Parental gate on one banner ad:
[myBanner enableParentalGate];
or
[myBanner setParentalGate:true];
- To disable the Parental gate on one banner ad:
[myBanner disableParentalGate];
or
[myBanner setParentalGate:false];
- To enable the Parental gate on all interstitial ads:
[SAInterstitialAd enableParentalGate];
or
[SAInterstitialAd setParentalGate:true];
- To disable the Parental gate on all video ads:
[SAVideoAd disableParentalGate];
or
[SAVideoAd setParentalGate:false];
Example
import SuperAwesome
class MyViewController: UIViewController {
var bannerAd: BannerView!
override func viewDidLoad() {
super.viewDidLoad()
bannerAd = BannerView()
// enable the Parental gate on the banner
bannerAd.enableParentalGate()
// add a callback
bannerAd.setCallback { [weak self] placementId, event in
// when the ad loads, play it directly
if event == .adLoaded {
self?.bannerAd.play()
}
}
}
}
#import "SuperAwesome.h"
@interface MyViewController: UIViewController
@property (weak, nonatomic) IBOutlet SABannerAd *bannerAd;
@end
@implementation MyViewController
- (void) viewDidLoad {
[super viewDidLoad];
// enable the Parental gate on the banner
[_bannerAd enableParentalGate];
// add a callback
__weak MyViewController *weakSelf = self;
[_bannerAd setCallback:^(NSInteger placementId, SAEvent event) {
// when the ad loads, play it directly
if (event == SAEventAdLoaded) {
[weakSelf.bannerAd play];
}
}];
// start the loading process
[_bannerAd load:30471];
}
@end