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.
That way, you will not miss events.
Each broadcast event includes the following parameters:
Name
Description
Example
ad_format
The ad format of the ad.
BANNER, MREC, INTER, REWARDED
country_code
The revenue’s country code.
US (for the United States)
id
Unique internal ID for the serve.
19017d954ffcded6c42772b09ec36699efe0bfc2
max_ad_unit_id
The MAX Ad Unit ID.
65d8d0195e50bda6
network_name
Display name of the network that shows the ad.
AppLovin
revenue
A double representing the revenue amount.
0.002067201
third_party_ad_placement_id
The ad’s placement ID, if any (bidding may not have one).
inter_regular
user_segment
The user segment of the user to whom the ad shows.
experiment5
The following example shows how you subscribe to and process the events that the SDK broadcasts.
// In the case that you are subscribed to multiple topics, check for the desired one
if"max_revenue_events"== message.topic
{
let revenue = message.data["revenue"] as!Double
// MAX revenue event messages will also contain the same info as MAX ad event messages, but without the "type"
let countryCode = message.data["country_code"] as!String// "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD"
let networkName = message.data["network_name"] as!String// Display name of the network which showed the ad
let adUnitId = message.data["max_ad_unit_id"] as!String// The MAX Ad Unit ID
let thirdPartyAdPlacementId = message.data["third_party_ad_placement_id"] as!String// The ad's placement id, if any (bidding may not have one)
let adFormat = message.data["ad_format"] as!String// The ad format of the ad (e.g. "BANNER", "MREC", "INTER", "REWARDED")