Skip to content

Rewarded Ads

Loading 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_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

Showing a Rewarded Ad

To show a rewarded ad, call show_rewarded():

if applovin.is_rewarded_ready(«ad-unit-ID») then
applovin.show_rewarded(«ad-unit-ID»)

S2S Rewarded Callbacks

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.

Setting the Amount and Currency for a Rewarded Ad

To set the reward amount and currency:

  1. Click Add S2S Reward Callback in your Edit Ad Unit page: Ad Type: ☐App Open, ☐Banner, ☐Interstitial, ☐MRec, ☐Native, ☑Rewarded. Add S2S Reward Callback.
  2. Add the Server Side Callback URL, Reward Amount, and Rewarded Currency Name: Ad Type: ☐App Open, ☐Banner, ☐Interstitial, ☐MRec, ☐Native, ☑Rewarded. Hide Callback Settings. Server Side Callback URL form field. Reward Amount form field. Rewarded Currency Name form field. AppLovin Event Key form field.