Rewarded interstitialStay organized with collectionsSave and categorize content based on your preferences.
AI-generated Key Takeaways
Rewarded interstitial ads offer rewards for automatic ad views during app transitions without requiring user opt-in.
Integrating rewarded interstitial ads involves loading an ad, optionally validating SSV callbacks, registering for callbacks, displaying the ad, and handling the reward event.
You must present users with an intro screen explaining the reward and providing an opt-out option before displaying a rewarded interstitial ad.
The GADUserDidEarnRewardHandler object is used to handle the reward given to the user after the ad is displayed.
Rewarded interstitialis a type
of incentivized ad format that allows you offer rewards for ads that appear
automatically during natural app transitions. Unlike rewarded ads, users aren't
required to opt-in to view a rewarded interstitial.
The primary steps to integrate rewarded interstitial ads are as follows:
Load an ad
[Optional] Validate SSV callbacks
Register for callbacks
Display the ad and handle the reward event
Load an ad
Loading an ad is accomplished using theload(adUnitID:request)method on theGADRewardedInterstitialAdclass.
Swift
funcloadRewardedInterstitialAd()async{do{rewardedInterstitialAd=tryawaitRewardedInterstitialAd.load(// Replace this ad unit ID with your own ad unit ID.with:"adUnitID",request:Request())rewardedInterstitialAd?.fullScreenContentDelegate=self}catch{print("Rewarded ad failed to load with error:\(error.localizedDescription)")}}
importGoogleMobileAdsclassRewardedInterstitialViewModel:NSObject,ObservableObject,FullScreenContentDelegate{@Publishedvarcoins=0privatevarrewardedInterstitialAd:RewardedInterstitialAd?funcloadAd()async{do{rewardedInterstitialAd=tryawaitRewardedInterstitialAd.load(with:"ca-app-pub-3940256099942544/6978759866",request:Request())rewardedInterstitialAd?.fullScreenContentDelegate=self}catch{print("Failed to load rewarded interstitial ad with error:\(error.localizedDescription)")}}
-(void)loadRewardedInterstitialAd{[GADRewardedInterstitialAdloadWithAdUnitID:"adUnitID"request:[GADRequestrequest]completionHandler:^(GADRewardedInterstitialAd*ad,NSError*error){if(error){NSLog(@"Failed to load rewarded interstitial ad with error: %@",error.localizedDescription);return;}self.rewardedInterstitialAd=ad;self.rewardedInterstitialAd.fullScreenContentDelegate=self;}];}
Apps that require extra data inserver-side
verificationcallbacks should use the
custom data feature of rewarded ads. Any string value set on a rewarded ad
object is passed to thecustom_dataquery parameter of the SSV callback. If no
custom data value is set, thecustom_dataquery parameter value won't be
present in the SSV callback.
The following code sample demonstrates how to set custom data on a rewarded
interstitial ad object before requesting an ad.
Swift
privatefuncvalidateServerSideVerification()async{do{rewardedInterstitialAd=tryawaitRewardedInterstitialAd.load(// Replace this ad unit ID with your own ad unit ID.with:"adUnitID",request:Request())letoptions=ServerSideVerificationOptions()options.customRewardText=""SAMPLE_CUSTOM_DATA_STRING""rewardedInterstitialAd?.serverSideVerificationOptions=options}catch{print("Rewarded ad failed to load with error:\(error.localizedDescription)")}}
-(void)validateServerSideVerification{// Replace this ad unit ID with your own ad unit ID.[GADRewardedInterstitialAdloadWithAdUnitID:"adUnitID"request:[GADRequestrequest]completionHandler:^(GADRewardedInterstitialAd*ad,NSError*error){if(error){NSLog(@"Rewarded interstitial ad failed to load with error: %@",error.localizedDescription);return;}self.rewardedInterstitialAd=ad;GADServerSideVerificationOptions*options=[[GADServerSideVerificationOptionsalloc]init];options.customRewardString=@""SAMPLE_CUSTOM_DATA_STRING"";ad.serverSideVerificationOptions=options;}];}
ReplaceSAMPLE_CUSTOM_DATA_STRINGwith your custom data.
Register for callbacks
To receive notifications for presentation events, you must assign theGADFullScreenContentDelegateto thefullScreenContentDelegateproperty of
the returned ad:
TheGADFullScreenContentDelegateprotocol handles callbacks for when the ad
presents successfully or unsuccessfully, and when it is dismissed. The following
code shows how to implement the protocol and assign it to the ad:
Swift
funcadDidRecordImpression(_ad:FullScreenPresentingAd){print("\(#function)called.")}funcadDidRecordClick(_ad:FullScreenPresentingAd){print("\(#function)called.")}funcadWillPresentFullScreenContent(_ad:FullScreenPresentingAd){print("\(#function)called.")}funcadWillDismissFullScreenContent(_ad:FullScreenPresentingAd){print("\(#function)called.")}funcadDidDismissFullScreenContent(_ad:FullScreenPresentingAd){print("\(#function)called.")// Clear the rewarded interstitial ad.rewardedInterstitialAd=nil}funcad(_ad:FullScreenPresentingAd,didFailToPresentFullScreenContentWithErrorerror:Error){print("\(#function)called with error:\(error.localizedDescription).")}
-(void)adDidRecordImpression:(id<GADFullScreenPresentingAd>)ad{NSLog(@"%s called",__PRETTY_FUNCTION__);}-(void)adDidRecordClick:(id<GADFullScreenPresentingAd>)ad{NSLog(@"%s called",__PRETTY_FUNCTION__);}-(void)adWillPresentFullScreenContent:(id<GADFullScreenPresentingAd>)ad{NSLog(@"%s called",__PRETTY_FUNCTION__);}-(void)adWillDismissFullScreenContent:(id<GADFullScreenPresentingAd>)ad{NSLog(@"%s called",__PRETTY_FUNCTION__);}-(void)adDidDismissFullScreenContent:(id<GADFullScreenPresentingAd>)ad{NSLog(@"%s called",__PRETTY_FUNCTION__);// Clear the rewarded interstitial ad.self.rewardedInterstitialAd=nil;}-(void)ad:(id)addidFailToPresentFullScreenContentWithError:(NSError*)error{NSLog(@"%s called with error: %@",__PRETTY_FUNCTION__,error.localizedDescription);}
When presenting your ad, you must provide aGADUserDidEarnRewardHandlerobject
to handle the reward for the user.
The following code presents the best method for displaying a rewarded
interstitial ad.
Swift
funcshowRewardedInterstitialAd(){guardletrewardedInterstitialAd=rewardedInterstitialAdelse{returnprint("Ad wasn't ready.")}// The UIViewController parameter is an optional.rewardedInterstitialAd.present(from:nil){letreward=rewardedInterstitialAd.adRewardprint("Reward received with currency\(reward.amount), amount\(reward.amount.doubleValue)")// TODO: Reward the user.}}
-(void)showRewardedInterstitialAd{[self.rewardedInterstitialAdpresentFromRootViewController:selfuserDidEarnRewardHandler:^{GADAdReward*reward=self.rewardedInterstitialAd.adReward;NSString*rewardMessage=[NSStringstringWithFormat:@"Reward received with "@"currency %@ , amount %ld",reward.type,[reward.amountlongValue]];NSLog(@"%@",rewardMessage);// TODO: Reward the user.}];}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-31 UTC."],[],["Rewarded interstitial ads are loaded using the `load(adUnitID:request)` method. Optionally, server-side verification (SSV) callbacks can be validated by setting custom data. To receive notifications, register for callbacks by implementing the `GADFullScreenContentDelegate` protocol. Ads are displayed using `present(fromRootViewController:)`, and rewards are handled via `GADUserDidEarnRewardHandler`. Ensure a pre-ad intro screen with reward details and a skip option is presented. Preload ads to reduce latency, refreshing the cache hourly.\n"]]