Skip to main content

Rewarded Ads

Rewarded ads let users opt-in to watch a video ad in exchange for an in-game reward (extra lives, premium content, virtual currency, etc.).

Each ad format uses a Zone ID to identify the ad placement. Zone IDs are configured in the Empower dashboard.

tip

Load the rewarded ad in advance and show it when the user chooses to watch. Grant the reward only on the Rewarded status.


Loading a Rewarded Ad​

Load the ad in advance, after OnSdkReady:

EmpowerAds.LoadRewardedAd("YOUR_REWARDED_ZONE_ID");

Showing a Rewarded Ad​

Show the ad when the user chooses to watch:

EmpowerAds.ShowRewarded("YOUR_REWARDED_ZONE_ID");

Listening to Rewarded Status​

OnRewardedStatusChanged reports these statuses:

StatusReported when
InitializingThe load started
ReadyAd is loaded and ready to display
ShownAd is being displayed
RewardedUser earned the reward
SkippedThe user dismissed the ad
ClosedThe ad is closed
WillLeaveUser clicked the ad (leaving the game)
FailedThe zone could not load an ad and has given up
warning

Grant the reward on Rewarded and nowhere else. Skipped and Closed are reported when the ad is dismissed, whether or not the reward was earned.

Grant the reward on Rewarded and load the next ad on Closed:

using Empower.MobileAds;
using UnityEngine;

public class RewardedController : MonoBehaviour
{
private const string ZoneId = "YOUR_REWARDED_ZONE_ID";
private bool _isReady;

void OnEnable()
{
EmpowerAds.OnRewardedStatusChanged += HandleRewardedStatus;
}

void OnDisable()
{
EmpowerAds.OnRewardedStatusChanged -= HandleRewardedStatus;
}

// Call after OnSdkReady.
public void Load()
{
EmpowerAds.LoadRewardedAd(ZoneId);
}

// Wire this to your "watch an ad" button.
public void Show()
{
if (_isReady)
EmpowerAds.ShowRewarded(ZoneId);
}

private void HandleRewardedStatus(AdStatus status, string zoneId)
{
if (zoneId != ZoneId) return;

switch (status)
{
case AdStatus.Ready:
_isReady = true;
break;
case AdStatus.Failed:
_isReady = false;
break;
case AdStatus.Rewarded:
GrantReward();
break;
case AdStatus.Closed:
_isReady = false;
EmpowerAds.LoadRewardedAd(ZoneId);
break;
}
}

private void GrantReward()
{
// Give the player the reward.
}
}
iOS

On Android Closed always follows Skipped, so loading the next ad on Closed is enough. On iOS Closed may not follow, so handle Skipped there as well.