Rewarded Ads

Loading a Rewarded Ad

The following code shows you how to attach listeners and load the first rewarded ad:

final String _rewarded_ad_unit_ID = Platform.isAndroid ? "android_rewarded_ad_unit_ID" : "ios_rewarded_ad_unit_ID";

const int _maxExponentialRetryCount = 6;
var _rewardedAdRetryAttempt = 0; void initializeRewardedAd() { AppLovinMAX.setRewardedAdListener(RewardedAdListener(onAdLoadedCallback: (ad) { // Rewarded ad is ready to show. AppLovinMAX.isRewardedAdReady(_rewarded_ad_unit_ID) now returns 'true'. print('Rewarded ad loaded from ' + ad.networkName); // Reset retry attempt _rewardedAdRetryAttempt = 0; }, onAdLoadFailedCallback: (adUnitId, error) { // Rewarded ad failed to load. // AppLovin recommends that you retry with exponentially higher delays up to a maximum delay (in this case 64 seconds). _rewardedAdRetryAttempt = _rewardedAdRetryAttempt + 1;
if (_rewardedAdRetryAttempt > _maxExponentialRetryCount) return;
int retryDelay = pow(2, min(_maxExponentialRetryCount, _rewardedAdRetryAttempt)).toInt(); print('Rewarded ad failed to load with code ' + error.code.toString() + ' - retrying in ' + retryDelay.toString() + 's'); Future.delayed(Duration(milliseconds: retryDelay * 1000), () { AppLovinMAX.loadRewardedAd(_rewarded_ad_unit_ID); }); }, onAdDisplayedCallback: (ad) { ⋮ }, onAdDisplayFailedCallback: (ad, error) { ⋮ }, onAdClickedCallback: (ad) { ⋮ }, onAdHiddenCallback: (ad) { ⋮ }, onAdReceivedRewardCallback: (ad, reward) { ⋮ }));

void loadRewardedAd() {

Showing a Rewarded Ad

To show a rewarded ad, call ShowRewardedAd():

bool isReady = (await AppLovinMAX.isRewardedAdReady(_rewarded_ad_unit_ID))!;
if (isReady) {

S2S Rewarded Callbacks

To learn how to receive callbacks to your currency server, see the MAX S2S Rewarded Callback API guide and update the S2S Rewarded Callback URL in your Edit Ad Unit page.

Impression-level revenue data helps you better understand your users, calculate ROI precisely, and build accurate LTV models. MAX gives you revenue information associated with each impression, as well as information about the demand source and the creative served for supported networks.

You can either process the data directly yourself, or work with any of our supported analytics providers, which are listed in the “MMP Integration: MAX to MMP” section of this page.

Direct Integration: MAX to You

There are three ways you can get user-level revenue data:

User Revenue API

Use this API to retrieve user-level revenue data on a daily basis. You can retrieve this data aggregated for a particular user or with one row per impression. Data is available eight hours after UTC day end. Read more about it on the User Revenue API documentation page.


Starting in SDK version 10.3.0+, you can access impression-level user revenue data on the client side in real-time. You can find integration instructions in the Advanced Settings page.


If you want to access real-time revenue data on the server side, you can provide an impression postback to track impression-level user ad revenue data. Please contact your account team or the support team to enable this feature. This feature and the macros that the impression postback supports are described in the “Server-to-Server Impression Revenue API” section of this page.

MMP Integration: MAX to MMP

MAX partners with various analytics solutions to help you easily access your data in a single dashboard. You can work with any of our supported partners such as Adjust, GameAnalytics, AppsFlyer, or Singular to access impression-level ad revenue or aggregated ad revenue data. Please refer to the documentation pages maintained by those partners for more information.

Server-to-Server Impression Revenue API

Please contact your account team or the support team to enable this feature.

AppLovin can send (HTTP or HTTPS) GET requests, from its servers to an external endpoint that you define, whenever a MAX impression is recorded. AppLovin makes these postbacks soon after the impression, but they may be delayed by up to a few minutes. You can use an impression timestamp macro to reconcile any delay between the impression and the postback times.

If the postback receives a non-200 response code, AppLovin will retry the postback up to three more times: twice right away and then once more about 60 seconds later. The postback request will timeout if five seconds pass without a response.


Available Macros

You can incorporate any of the macros in the following table into your postback URL (as in the example URL above). AppLovin’s servers will replace these macro names with accurate values at the time it makes the postback to your server.

Name Description Example
{AD_UNIT_ID} MAX Ad Unit ID (16 hex characters) 9ad0816ac071552a
{AD_UNIT_NAME} Ad Unit name (URL-encoded) My%20App%20Banners
{AD_UNIT_TEST_NAME} Name of the ad unit test, URL-encoded Control
{ALL_REVENUE} Estimated revenue, including FB Bidding estimates 0.0121, 5.74466e-05
{CC} Two-letter country code of the user gb
{CURRENCY} The type of currency you choose to award the user (URL-encoded). You set this in the Ad Unit edit page for each Ad Unit. coins
{CUSTOM_DATA} Custom data passed in from the integration (URL-encoded). AppLovin recommends that you keep the size of the string under 8192 characters. my%20custom%20data
{DEVICE_TYPE} User’s device type. Tablet
{EVENT_ID} Unique event ID, 40 hex characters 8dc948013d71f04264b8e5c1c61933154b226e08
{EVENT_TOKEN} sha1( EVENT_ID + Your_Event_Key ) e000949f6d851c1f34adae08e6ef1076ba43cf31
{EVENT_TOKEN_ALL} sha256( All macros alphabetically, URL-decoded + Your_Event_Key )

If EVENT_TOKEN is one of your macros, it is omitted from the “All macros alphabetically” string.

{FORMAT} Ad Unit format reward, banner, inter
{IDFA} iOS IDFA or Google Advertising ID 860635ea-65bc-eaed-d355-1b5283b30b94
{IDFV} Identifier for Vendor 4CD1C3C4-3FD7-00F5-1635-7BC6D9387E60
{IP} User’s IP address (IPv6 values are URL-encoded), fe80%3A%3A1ff%3Afe23%3A4567%3A890a%0A
{NETWORK} Name of the ad network that served the impression. Names should match the names used in the ManagementAPI. APPLOVIN_NETWORK
{NETWORK_PLACEMENT} Placement name of the external ad network ca-app-pub-12345678%2F0987654321
{PACKAGE_NAME} App Package Name (Android) or Bundle ID (iOS). URL-encoded.
{PLACEMENT} Publisher-defined MAX ad placement name (URL-encoded) Launch%20Screen
{PLATFORM} Platform android, ios
{PRECISION} Information on how precise the revenue value is. Options are:
if revenue is the price assigned to the line item by the publisher
if revenue is the resulting price of a real-time auction
if the revenue amount is based on Auto CPM or FB Bidding estimates
if no line item amount is defined and there is not enough data to estimate
{REVENUE} Estimated revenue. Set to 0 when FB Bidding. 0.0121, 5.74466e-05
{TS} Timestamp of impression (integer, seconds since epoch) 1546300800
{USER_ID} Publisher-defined, URL-encoded, user ID; maximum length is 8192 characters 7634657898
{WATERFALL_NAME} The name of the Ad Unit waterfall LAT

Setting the Reward Amount and Currency

To set the reward amount and currency, click Add S2S Reward Callback in your Edit Ad Unit page:

Ad Type: ☐App Open, ☐Banner, ☐Interstitial, ☐MREC, ☐Native, ☑Rewarded. Add S2S Reward Callback.

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.