Rewarded ads let you offer users in-app items—such as continued gameplay, virtual currency, or other rewards—in exchange for their engagement with ads. Rewarded ads boost engagement because users receive a tangible benefit for their time.
The following sections show you how to load and then show a rewarded ad.
The following code shows you how to attach listeners and load the first rewarded ad:
local rewarded_ad_unit_ids = {
android = "«android-ad-unit-ID»",
ios = "«ios-ad-unit-ID»"
}
function initialize_rewarded_ads()
local ad_unit_id
local sysinfo = sys.get_sys_info()
if sysinfo.system_name == "Android" then
ad_unit_id = rewarded_ad_unit_ids["android"]
elseif sysinfo.system_name == "iPhone OS" then
ad_unit_id = rewarded_ad_unit_ids["ios"]
end
applovin.load_rewarded_ad(ad_unit_id)
-- Rewarded Ad Callbacks
local function applovin_callback(self, name, params)
if name == "OnRewardedAdLoadedEvent" then
-- Rewarded ad is ready to be shown. applovin.is_rewarded_ad_ready(ad_unit_id) will now return true
if name == "OnRewardedAdLoadFailedEvent" then
⋮
if name == "OnRewardedAdDisplayedEvent" then
⋮
if name == "OnRewardedAdDisplayFailedEvent" then
⋮
if name == "OnRewardedAdClickedEvent" then
⋮
if name == "OnRewardedAdReceivedRewardEvent" then
⋮
if name == "OnRewardedAdHiddenEvent" then
⋮
if name == "OnRewardedAdRevenuePaidEvent" then
⋮
To show a rewarded ad, call show_rewarded_ad():
if applovin.is_rewarded_ad_ready(«ad-unit-ID») then
applovin.show_rewarded_ad(«ad-unit-ID»)
You can receive callbacks to your currency server. To learn how, see the MAX S2S rewarded callback API guide. Then update the Server Side Callback URL in your Edit Ad Unit page.
To set the reward amount and currency:

