Rewarded Interstitial Ads
Rewarded interstitial ad units automatically appear and show full-page ads in your app that reward users for viewing ads. Place them at natural breaks & transitions in your app's interface, such as after level completion in a gaming app.
Benefits of Rewarded Interstitial Ads
- Encourages longer sessions as you can implement rewarded interstitial ads to reward players in-game after they’ve completed a video view. Also, gamers are motivated to continue playing, resulting in longer sessions.
- Improve user experience, leading to higher retention as this skippable, non-intrusive ad format doesn’t interrupt players during an app event
- Make an impression: These interactive, full-screen ads can grab attention when placed at natural transition points or breaks in the game (e.g. in between activities or game levels).
- Monetise more players: Rewarded interstitials can be tested to monetise players who may not engage with rewarded video and in-app purchases.
You should finish these steps before releasing.
Load the ad
- Unity
- Java
- Kotlin
- Swift
- Objective-C
- Godot
- React Native
Yodo1U3dRewardedInterstitialAd.GetInstance().LoadAd();
Yodo1MasRewardedInterstitialAd.getInstance().loadAd(MainActivity.this);
Yodo1MasRewardedInterstitialAd.getInstance().loadAd(this@MainActivity)
Yodo1MasRewardedInterstitialAd.sharedInstance().load()
[[Yodo1MasRewardedInterstitialAd sharedInstance] loadAd];
yodo1mas.initialize_rewarded_interstitial_ad()
yodo1mas.load_rewarded_interstitial_ad()
// Rewarded interstitial video ads are pre-loaded automatically
Loading a new ad from OnAdLoadFailedEvent()
without delay is not recommended.
If a new ad has to be loaded immediately on OnAdLoadFailedEvent()
, then the auto-delay configuration variable must be set to true to limit ad load retries, thus avoiding continuous failed ad requests and ANR issues.
- Unity
- Java
- Kotlin
- Swift
- Objective-C
- Godot
- React Native
// Remember to call this function before SDK init.
Yodo1U3dRewardedInterstitialAd.GetInstance().autoDelayIfLoadFail = true;
// Remember to call this function before SDK init.
Yodo1MasRewardedInterstitialAd.getInstance().autoDelayIfLoadFail = true
// Remember to call this function before SDK init.
Yodo1MasRewardedInterstitialAd.getInstance().autoDelayIfLoadFail = true
// Remember to call this function before SDK init.
Yodo1MasRewardedInterstitialAd.sharedInstance().autoDelayIfLoadFail = true
// Remember to call this function before SDK init.
[Yodo1MasRewardedInterstitialAd sharedInstance].autoDelayIfLoadFail = YES;
// No need to configure on Godot
// No need to configure on React Native
Display the ad
You can show the ad using this code, but we recommend using the ad events as you’ll be able to show the ad once it’s loaded. You can check the full script provided below.
- Unity
- Java
- Kotlin
- Swift
- Objective-C
- Godot
- React Native
bool isLoaded = Yodo1U3dRewardedInterstitialAd.GetInstance().IsLoaded();
// Show ad without placement name
if (isLoaded)
{
Yodo1U3dRewardedInterstitialAd.GetInstance().ShowAd();
}
// Show ad with placement name, like app_start, level_end
if (isLoaded)
{
Yodo1U3dRewardedInterstitialAd.GetInstance().ShowAd("Your placement ID");
}
boolean isLoaded = Yodo1MasRewardedInterstitialAd.getInstance().isLoaded();
// Show ad without placement name
if (isLoaded) Yodo1MasRewardedInterstitialAd.getInstance().showAd(this);
// Show ad with placement name, like app_start, level_end
if (isLoaded) Yodo1MasRewardedInterstitialAd.getInstance().showAd(this, "Your placement ID");
val isLoaded = Yodo1MasRewardedInterstitialAd.getInstance().isLoaded()
// Show ad without placement name
if (isLoaded) Yodo1MasRewardedInterstitialAd.getInstance().showAd(this@MainActivity)
// Show ad with placement name, like app_start, level_end
if (isLoaded) Yodo1MasRewardedInterstitialAd.getInstance().showAd(this@MainActivity, "Your placement ID")
let isLoaded = Yodo1MasRewardedInterstitialAd.sharedInstance().isLoaded()
// Show ad without placement name
if isLoaded { Yodo1MasRewardedInterstitialAd.sharedInstance().show() }
// Show ad with placement name, like app_start, level_end
if isLoaded { Yodo1MasRewardedInterstitialAd.sharedInstance().show(withPlacement: "Your placement ID") }
BOOL isLoaded = [[Yodo1MasRewardedInterstitialAd sharedInstance] isLoaded];
// Show ad without placement name
if (isLoaded) [[Yodo1MasRewardedInterstitialAd sharedInstance] showAd];
// Show ad with placement name, like app_start, level_end
if (isLoaded) [[Yodo1MasRewardedInterstitialAd sharedInstance] showAdWithPlacement:@"Your placement ID"];
yodo1mas.show_rewarded_interstitial_ad()
// Recommended, show the ad with a placement ID
Yodo1MASAds.showRewardInterstitialAdsWithPlacementId("Your placement ID");
// Or show the ad without a placement ID
Yodo1MASAds.showRewardInterstitialAds();
Configure the ad events
The MAS SDK fires several events to inform you of ad availability.
- Unity
- Java
- Kotlin
- Swift
- Objective-C
- Godot
- React Native
using Yodo1.MAS;
using System;
public class RewardedInterstitialAdLoader : MonoBehaviour
{
private int retryAttempt = 0;
private void Start()
{
SetupEventCallbacks();
LoadRewardedInterstitial();
}
private void SetupEventCallbacks()
{
Yodo1U3dRewardedInterstitialAd.GetInstance().OnAdLoadedEvent += OnRewardedInterstitialAdLoadedEvent;
Yodo1U3dRewardedInterstitialAd.GetInstance().OnAdLoadFailedEvent += OnRewardedInterstitialAdLoadFailedEvent;
Yodo1U3dRewardedInterstitialAd.GetInstance().OnAdOpenedEvent += OnRewardedInterstitialAdOpenedEvent;
Yodo1U3dRewardedInterstitialAd.GetInstance().OnAdOpenFailedEvent += OnRewardedInterstitialAdOpenFailedEvent;
Yodo1U3dRewardedInterstitialAd.GetInstance().OnAdClosedEvent += OnRewardedInterstitialAdClosedEvent;
Yodo1U3dRewardedInterstitialAd.GetInstance().OnAdEarnedEvent += OnRewardedInterstitialAdEarnedEvent;
}
private void LoadRewardedInterstitial()
{
Yodo1U3dRewardedInterstitialAd.GetInstance().SetAdPlacement("Your placement ID");
Yodo1U3dRewardedInterstitialAd.GetInstance().LoadAd();
}
private void OnRewardedInterstitialAdLoadedEvent(Yodo1U3dRewardedInterstitialAd ad)
{
// Code to be executed when an ad finishes loading.
retryAttempt = 0;
Yodo1U3dRewardedInterstitialAd.GetInstance().ShowAd();
}
private void OnRewardedInterstitialAdLoadFailedEvent(Yodo1U3dRewardedInterstitialAd ad, Yodo1U3dAdError adError)
{
// Code to be executed when an ad request fails.
retryAttempt++;
double retryDelay = Math.Pow(2, Math.Min(6, retryAttempt));
Invoke("LoadRewardedInterstitial", (float)retryDelay);
}
private void OnRewardedInterstitialAdOpenedEvent(Yodo1U3dRewardedInterstitialAd ad)
{
// Code to be executed when an ad opened
}
private void OnRewardedInterstitialAdOpenFailedEvent(Yodo1U3dRewardedInterstitialAd ad, Yodo1U3dAdError adError)
{
// Code to be executed when an ad open fails.
LoadRewardedInterstitial();
}
private void OnRewardedInterstitialAdClosedEvent(Yodo1U3dRewardedInterstitialAd ad)
{
// Code to be executed when the ad closed
LoadRewardedInterstitial();
}
private void OnRewardedInterstitialAdEarnedEvent(Yodo1U3dRewardedInterstitialAd ad)
{
// Code executed when getting rewards
}
}
public class RewardedInterstitialActivity extends Activity implements Yodo1MasRewardedInterstitialAdListener {
private final Handler handler = new Handler(Looper.getMainLooper());
private int retryAttempt;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rewarded_insterstitial);
Yodo1MasRewardedInterstitialAd.getInstance().setAdListener(this);
Yodo1MasRewardedInterstitialAd.getInstance().autoDelayIfLoadFail = true;
Yodo1MasRewardedInterstitialAd.getInstance().loadAd(this);
}
@Override
public void onRewardedInterstitialAdLoaded(Yodo1MasRewardedInterstitialAd ad) {
// Code to be executed when an ad finishes loading.
retryAttempt = 0;
// Show ad without placement name
Yodo1MasRewardedInterstitialAd.getInstance().showAd(this);
// Show ad with placement name, like app_start, level_end
// Yodo1MasRewardedInterstitialAd.getInstance().showAd(this, "Your placement ID");
}
@Override
public void onRewardedInterstitialAdFailedToLoad(Yodo1MasRewardedInterstitialAd ad, @NonNull Yodo1MasError error) {
// Code to be executed when an ad request fails.
retryAttempt++;
long delayMillis = TimeUnit.SECONDS.toMillis((long) Math.pow(2, Math.min(5, retryAttempt)));
handler.postDelayed(new Runnable() {
@Override
public void run() {
Yodo1MasRewardedInterstitialAd.getInstance().loadAd(this);
}
}, delayMillis);
}
@Override
public void onRewardedInterstitialAdOpened(Yodo1MasRewardedInterstitialAd ad) {
// Code to be executed when an ad opened
}
@Override
public void onRewardedInterstitialAdFailedToOpen(Yodo1MasRewardedInterstitialAd ad, @NonNull Yodo1MasError error) {
// Code to be executed when an ad open fails.
Yodo1MasRewardedInterstitialAd.getInstance().loadAd(this);
}
@Override
public void onRewardedInterstitialAdClosed(Yodo1MasRewardedInterstitialAd ad) {
// Code to be executed when the ad closed
Yodo1MasRewardedInterstitialAd.getInstance().loadAd(this);
}
@Override
public void onRewardedInterstitialAdEarned(Yodo1MasRewardedInterstitialAd ad) {
// Code executed when getting rewards
}
}
class RewardedInterstitialActivity: Activity(), Yodo1MasRewardedInterstitialAdListener {
private val handler = Handler(Looper.getMainLooper()!!)
private var retryAttempt = 0
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_rewarded_interstitial)
Yodo1MasRewardedInterstitialAd.getInstance().setAdListener(this)
Yodo1MasRewardedInterstitialAd.getInstance().autoDelayIfLoadFail = true
Yodo1MasRewardedInterstitialAd.getInstance().loadAd(this)
}
override fun onRewardedInterstitialAdLoaded(ad: Yodo1MasRewardedInterstitialAd) {
// Code to be executed when an ad finishes loading.
retryAttempt = 0
// Show ad without placement name
Yodo1MasRewardedInterstitialAd.getInstance().showAd(this)
// Show ad with placement name, like app_start, level_end
// Yodo1MasRewardedInterstitialAd.getInstance().showAd(this, "Your placement ID")
}
override fun onRewardedInterstitialAdFailedToLoad(ad: Yodo1MasRewardedInterstitialAd, error: Yodo1MasError) {
// Code to be executed when an ad request fails.
retryAttempt++
val delayMillis = TimeUnit.SECONDS.toMillis(2.toDouble().pow(5.coerceAtMost(retryAttempt)).toLong())
handler.postDelayed({
Yodo1MasRewardedInterstitialAd.getInstance().loadAd(this)
}, delayMillis)
}
override fun onRewardedInterstitialAdOpened(ad: Yodo1MasRewardedInterstitialAd) {
// Code to be executed when an ad opened
}
override fun onRewardedInterstitialAdFailedToOpen(ad: Yodo1MasRewardedInterstitialAd, error: Yodo1MasError) {
// Code to be executed when an ad open fails.
Yodo1MasRewardedInterstitialAd.getInstance().loadAd(this)
}
override fun onRewardedInterstitialAdClosed(ad: Yodo1MasRewardedInterstitialAd) {
// Code to be executed when the ad closed
Yodo1MasRewardedInterstitialAd.getInstance().loadAd(this)
}
override fun onRewardedInterstitialAdEarned(ad: Yodo1MasRewardedInterstitialAd) {
// Code executed when getting rewards
}
}
class RewardedInterstitialController: UIViewController {
private var retryAttempt = 0
override func viewDidLoad() {
super.viewDidLoad()
Yodo1MasRewardedInterstitialAd.sharedInstance().adDelegate = self
Yodo1MasRewardedInterstitialAd.sharedInstance().autoDelayIfLoadFail = true
Yodo1MasRewardedInterstitialAd.sharedInstance().load()
}
}
extension RewardedInterstitialController: Yodo1MasRewardedInterstitialAdDelegate {
func onRewardedInterstitialAdLoaded(_ ad: Yodo1MasRewardedInterstitialAd) {
// Code to be executed when an ad finishes loading.
retryAttempt = 0
// Show ad without placement name
Yodo1MasRewardedInterstitialAd.sharedInstance().show()
// Show ad with placement name, like app_start, level_end
// Yodo1MasRewardedInterstitialAd.sharedInstance().show(withPlacement: "Your placement ID")
}
func onRewardedInterstitialAdFailed(toLoad ad: Yodo1MasRewardedInterstitialAd, withError error: Yodo1MasError) {
// Code to be executed when an ad request fails.
retryAttempt+=1
let delaySec = NSDecimalNumber(decimal: pow(2, min(5, retryAttempt))).doubleValue
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + delaySec) {
Yodo1MasRewardAd.sharedInstance().load()
}
}
func onRewardedInterstitialAdOpened(_ ad: Yodo1MasRewardedInterstitialAd) {
// Code to be executed when an ad opened
}
func onRewardedInterstitialAdFailed(toOpen ad: Yodo1MasRewardedInterstitialAd, withError error: Yodo1MasError) {
// Code to be executed when an ad open fails.
Yodo1MasRewardedInterstitialAd.sharedInstance().load()
}
func onRewardedInterstitialAdClosed(_ ad: Yodo1MasRewardedInterstitialAd) {
// Code to be executed when the ad closed
Yodo1MasRewardedInterstitialAd.sharedInstance().load()
}
func onRewardedInterstitialAdEarned(_ ad: Yodo1MasRewardedInterstitialAd) {
// Code executed when getting rewards
}
}
@interface RewardedInterstitialViewController()<Yodo1MasRewardedInterstitialAdDelegate>
@property (nonatomic, assign) NSInteger retryAttempt;
@end
@implementation RewardedInterstitialViewController
- (void)viewDidLoad {
[super viewDidLoad];
[Yodo1MasRewardedInterstitialAd sharedInstance].adDelegate = self;
[Yodo1MasRewardedInterstitialAd sharedInstance].autoDelayIfLoadFail = YES;
[[Yodo1MasRewardedInterstitialAd sharedInstance] loadAd];
}
#pragma mark - Yodo1MasRewardedInterstitialAdDelegate
- (void)onRewardedInterstitialAdLoaded:(Yodo1MasRewardedInterstitialAd *)ad {
// Code to be executed when an ad finishes loading.
_retryAttempt = 0;
// Show ad without placement name
[[Yodo1MasRewardedInterstitialAd sharedInstance] showAd];
// Show ad with placement name, like app_start, level_end
// [[Yodo1MasRewardedInterstitialAd sharedInstance] showAdWithPlacement:@"Your placement ID"];
}
- (void)onRewardedInterstitialAdFailedToLoad:(Yodo1MasRewardedInterstitialAd *)ad withError:(Yodo1MasError *)error {
// Code to be executed when an ad request fails.
_retryAttempt++;
NSInteger delaySec = pow(2, MIN(5, self.retryAttempt));
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, delaySec * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[[Yodo1MasRewardedInterstitialAd sharedInstance] loadAd];
});
}
- (void)onRewardedInterstitialAdOpened:(Yodo1MasRewardedInterstitialAd *)ad {
// Code to be executed when an ad opened
}
- (void)onRewardedInterstitialAdFailedToOpen:(Yodo1MasRewardedInterstitialAd *)ad withError:(Yodo1MasError *)error {
// Code to be executed when an ad open fails.
[[Yodo1MasRewardedInterstitialAd sharedInstance] loadAd];
}
- (void)onRewardedInterstitialAdClosed:(Yodo1MasRewardedInterstitialAd *)ad {
// Code to be executed when the ad closed
[[Yodo1MasRewardedInterstitialAd sharedInstance] loadAd];
}
- (void)onRewardedInterstitialAdEarned:(Yodo1MasRewardedInterstitialAdAd *)ad {
// Code executed when getting rewards
}
@end
func _on_interstitial_rewarded_ad_loaded() -> void:
emit_signal("interstitial_rewarded_ad_loaded")
func _on_interstitial_rewarded_ad_failed_load() -> void:
emit_signal("interstitial_rewarded_ad_not_loaded")
func _on_interstitial_rewarded_ad_opened() -> void:
emit_signal("interstitial_rewarded_ad_opened")
func _on_interstitial_rewarded_ad_failed_to_opened() -> void:
emit_signal("interstitial_rewarded_ad_failed_to_opened")
func _on_interstitial_rewarded_ad_closed() -> void:
emit_signal("interstitial_rewarded_ad_closed")
func _on_interstitial_rewarded_ad_earned() -> void:
print("Godot app -> yodo1mas, _on_interstitial_rewarded_ad_earned")
emit_signal("interstitial_rewarded_ad_earned")
const handleEvents = ({value}) => {
__DEV__ && console.log(`Event: ${value}`);
switch (value) {
case 'onRewardedInterstitialAdEarned':
// Handle the event when the user has earned a reward
break;
case 'onRewardedInterstitialAdLoaded':
// Handle the event when the ad is loaded
break;
case 'onRewardedInterstitialAdOpened':
// Handle the event when the ad is opened
break;
case 'onRewardedInterstitialAdClosed':
// Handle the event when the ad is closed
break;
case 'onRewardedInterstitialAdFailedToLoad':
// Ad failed to load, let's try again after a delay
break;
case 'onRewardedInterstitialAdFailedToOpen':
// Ad failed to open, let's try again after a delay
break;
}
};
export const registerYodo1MAS = () => {
const eventEmitter = new NativeEventEmitter(Yodo1MASAds);
const eventListener = eventEmitter.addListener('adEvent', handleEvents);
// If needed, pass CCPA, COPPA, GDPR values in the initSDK method
Yodo1MASAds.initMasSdk(true, true, true);
return eventListener;
};
Impression-Level User Revenue
Starting in SDK version 4.13.2, you can access impression-level user revenue data on the client side. You can use this data to compare different sources and campaigns.
You can share impression-level ad revenue data with your mobile measurement partner of choice.
You can retrieve the revenue amount in all ad lifecycle callbacks. The following example shows how to do this within callback:
- Unity
- Java
- Kotlin
- Swift
- Objective-C
Yodo1U3dRewardedInterstitialAd.GetInstance().OnAdPayRevenueEvent += OnRewardedInterstitialAdPayRevenueEvent;
private void OnRewardedInterstitialAdPayRevenueEvent(Yodo1U3dRewardedInterstitialAd ad, Yodo1U3dAdValue adValue)
{
double revenue = adValue.Revenue;
string currency = adValue.Currency;
}
Yodo1U3dRewardedInterstitialAd.GetInstance().setAdRevenueListener(new Yodo1MasRewardedInterstitialAdRevenueListener() {
@Override
public void onRewardedInterstitialAdPayRevenue(Yodo1MasRewardedInterstitialAd ad, Yodo1MasAdValue adValue) {
double revenue = adValue.getRevenue();
String currency = adValue.getCurrency();
}
});
Yodo1U3dRewardedInterstitialAd.GetInstance().setAdRevenueListener { ad, adValue ->
val revenue = adValue.revenue
val currency = adValue.currency
}
Yodo1MasRewardedInterstitialAd.sharedInstance().adRevenueDelegate = self
func onRewardedInterstitialAdPayRevenue(_ ad: Yodo1MasRewardAd, _ adValue: Yodo1MasAdValue)
{
let revenue = adValue.revenue
let currency = adValue.currency
}
[Yodo1MasRewardedInterstitialAd sharedInstance].adRevenueDelegate = self;
#pragma mark - Yodo1MasRewardedInterstitialAdRevenueDelegate
- (void)onRewardedInterstitialAdPayRevenue:(Yodo1MasRewardedInterstitialAd *)ad withAdValue:(Yodo1MasAdValue *)adValue {
double revenue = adValue.revenue;
NSString *currency = adValue.currency;
}
You can also retrieve a precision evaluation for the revenue value, as shown in the following example:
- Unity
- Java
- Kotlin
- Swift
- Objective-C
string revenuePrecision = adValue.RevenuePrecision;
String revenuePrecision = adValue.getRevenuePrecision();
val revenuePrecision = adValue.revenuePrecision
let revenuePrecision = adValue.revenuePrecision
NSString *revenuePrecision = adValue.revenuePrecision;
Best Practices
1. Preload
We recommend that you preload the rewarded interstitial ad before showing it. This will ensure the ad is ready to be displayed when needed.
2. Placement
We recommend setting the placement name when you load and show the ad. This will help you track each placement's performance in the dashboard.
3. Handle Failures
If the ad fails to load, you should NOT try to reload immediately. Instead, it would be best if you waited a while before reloading the ad again. We recommend waiting at least 10 seconds before trying to fill the ad.