Skip to content

Impression-Level User Revenue API for MMPs

This API uses a publisher-subscriber architecture. The MAX SDK broadcasts MAX ad revenue events and MMPs subscribe to the max_revenue_events topic. AppLovin recommends that you subscribe to that topic immediately after your app launches. This way, you will not miss events. Each broadcast event includes the following parameters:

NameDescriptionExample
ad_formatThe ad format of the ad.BANNER, MREC, INTER, REWARDED
country_codeThe revenue’s country code.US (for the United States)
idUnique internal ID for the serve.19017d954ffcded6c42772b09ec36699efe0bfc2
max_ad_unit_idThe MAX Ad Unit ID.65d8d0195e50bda6
network_nameDisplay name of the network that showed the ad.AppLovin
revenueA double that represents the revenue amount.0.002067201
third_party_ad_placement_idThe ad’s placement ID, if any (bidding may not have one).inter_regular
user_segmentThe user segment of the user to whom the ad was shown.experiment5

The following example shows how you subscribe to and process the events that the SDK broadcasts.

package «your.package.name»;
import android.app.Activity;
import android.os.Bundle;
import com.applovin.communicator.AppLovinCommunicator;
import com.applovin.communicator.AppLovinCommunicatorMessage;
import com.applovin.communicator.AppLovinCommunicatorSubscriber;
import androidx.annotation.Nullable;
public class ExampleActivity
extends Activity
implements AppLovinCommunicatorSubscriber
{
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState)
{
super.onCreate( savedInstanceState );
AppLovinCommunicator.getInstance( getApplicationContext() ).subscribe( this, "max_revenue_events" );
}
@Override
protected void onDestroy()
{
// Unsubscribe when subscription is no longer needed
AppLovinCommunicator.getInstance( getApplicationContext() ).unsubscribe( this, "max_revenue_events" );
super.onDestroy();
}
@Override
public void onMessageReceived(final AppLovinCommunicatorMessage message)
{
// If you are subscribed to multiple topics, check for the desired one
if ( "max_revenue_events".equals( message.getTopic() ) )
{
Bundle data = message.getMessageData();
double revenue = data.getDouble( "revenue" );
// Miscellaneous data
String countryCode = data.getString( "country_code" ); // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD"
String networkName = data.getString( "network_name" ); // Display name of the network which showed the ad
String adUnitId = data.getString( "max_ad_unit_id" ); // The MAX Ad Unit ID
String thirdPartyAdPlacementId = data.getString( "third_party_ad_placement_id" ); // The ad's placement id, if any (bidding may not have one)
String adFormat = data.getString( "ad_format" ); // The ad format of the ad (e.g. "BANNER", "MREC", "INTER", "REWARDED", "REWARDED_INTER")
String userSegment = data.getString( "user_segment" ); // The user segment of the user to whom the ad was shown
}
}
@Override
public String getCommunicatorId()
{
return "«your_company_name_in_snake_case»";
}
}