### Install AppLovin MAX Plugin Source: https://support.axon.ai/en/max/flutter/overview/integration Run `flutter pub get` to install the AppLovin MAX plugin after manually adding the dependency to pubspec.yaml. ```bash flutter pub get ``` -------------------------------- ### Basic CocoaPods Setup Source: https://support.axon.ai/en/max/cordova/preparing-mediated-networks A minimal CocoaPods setup for your project. This is a base structure that can be expanded with specific network pods. ```ruby # Settings use_frameworks! inhibit_all_warnings! # Pods target 'YOUR_PROJECT_NAME' do end ``` -------------------------------- ### Frequency Capping Settings Example Source: https://support.axon.ai/en/max/advanced-features/ad-unit-management-api An example of `frequency_capping_settings` for an ad unit, specifying time-based capping and country inclusion. ```json { "type": "time", "time_capping_settings": { "day_limit": 10, "minute_frequency": 10 }, "session_capping_settings": { "session_limit": 0 }, "countries" : { "type": "INCLUDE", "values" : [ "ca", "us" ] } } ``` -------------------------------- ### Example app-ads.txt File Source: https://support.axon.ai/en/max/max-dashboard/account/iab-supply-chain-validation This is an example of an app-ads.txt file. It lists authorized sellers of your app inventory, including their domain, publisher ID, and relationship type. ```text # Network Name, Publisher/Account ID, Relationship Type applovin.com, 9eaf9ad6dc92d5fcn6f47c30168fb8fq, DIRECT mintegral.com, 19435, DIRECT, 0aeed123c80d6423 google.com, pub-3940498599942544, DIRECT, f08c47fec0986fa0 ``` -------------------------------- ### Install CocoaPods Dependencies Source: https://support.axon.ai/en/max/ios/overview/integration After updating your Podfile, run this command in your terminal to install the SDK and any other dependencies. ```bash pod install --repo-update ``` -------------------------------- ### Ad Network Settings Example Source: https://support.axon.ai/en/max/advanced-features/ad-unit-management-api An example of the `ad_network_settings` array, specifically configuring AdMob network details including app ID and disabling the network. ```json { "ADMOB_NETWORK": { "disabled": true, "ad_network_app_id": "ca-app-pub-3555987499620362~3024971981", "ad_network_ad_units": [] } } ``` -------------------------------- ### Initialize and Load App Open Ad (Swift) Source: https://support.axon.ai/en/max/ios/ad-formats/app-open-ads This Swift snippet demonstrates initializing the AppLovin SDK, creating an MAAppOpenAd instance, setting its delegate, and loading the ad. This setup is typically done in the application's launch process. ```Swift @UIApplicationMain class AppDelegate: UIApplicationDelegate { private lazy var appOpenAd = MAAppOpenAd(adUnitIdentifier: "«ad-unit-ID»") func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { ALSdk.shared().initializeSdk { appOpenAd.delegate = self appOpenAd.load() } return true } func applicationDidBecomeActive(_ application: UIApplication) { showAdIfReady() } private func showAdIfReady() { if ALSdk.shared().isInitialized { return } if appOpenAd.isReady { appOpenAd.show(forPlacement: "«test-placement-ID»") } else { appOpenAd.load() } } } extension AppDelegate : MAAdDelegate { func didLoad (_ ad: MAAd) {} func didFailToLoadAd(forAdUnitIdentifier adUnitIdentifier: String, withError error: MAError) {} func didDisplay (_ ad: MAAd) {} func didClick (_ ad: MAAd) {} func didHide (_ ad: MAAd) { appOpenAd.load() } func didFail(toDisplay ad: MAAd, withError error: MAError) { appOpenAd.load() } } ``` -------------------------------- ### Example CTV Bid Request Source: https://support.axon.ai/en/max/demand-partners/demand-side-platforms/applovin-ortb-specification/bid-requests This snippet shows an example of a Connected TV (CTV) bid request. It includes parameters specific to video ad delivery like start delay, bitrate, and protocols, along with user and regulatory information. ```json { "id": "8071013005311111111", "imp": [ { "id": "1", "metric": [ { "type": "viewability", "value": 0 } ], "video": { "w": 1920, "h": 1080, "minduration": 5, "maxduration": 60, "startdelay": -1, "minbitrate": 1, "maxbitrate": 280000, "linearity": 1, "sequence": 1, "protocols": [ 1, 2, 3, 4, 5, 6 ], "podid": "pod_1", "podseq": 0, "slotinpod": 0, "ext": { "maxsequence": 1 } }, "rwdd": 0, "ext": {} } ], "user": { "ext": { "gdpr": 0 }, "id": "66dcd4a1-a0ed-b2b8-7e1a-3d2ea2ecc889" }, "regs": { "ext": { "ccpa": 0, "gdpr": 0 } }, "source": { "ext": { "schain": { "ver": "1.0", "complete": 1, "nodes": [ { "asi": "applovin.com", "sid": "61310", "rid": "eb3ebe82eb5223c2525d46bd3bef213649466b0a", "hp": 1 } ] } } } } ``` -------------------------------- ### Initialize SDK and Show App Open Ad Source: https://support.axon.ai/en/max/unity/ad-formats/app-open-ads This snippet shows how to initialize the MAX SDK, register callbacks for app open ad events, and display an ad if it's ready. It also handles loading the next ad after one is dismissed. ```csharp public class ExampleHomeScreen : MonoBehaviour { void Start() { MaxSdkCallbacks.OnSdkInitializedEvent += sdkConfiguration => { MaxSdkCallbacks.AppOpen.OnAdHiddenEvent += OnAppOpenDismissedEvent; AppOpenManager.Instance.ShowAdIfReady(); }; MaxSdk.InitializeSdk(); } public void OnAppOpenDismissedEvent(string adUnitId, MaxSdk.AdInfo adInfo) { MaxSdk.LoadAppOpenAd(AppOpenAdUnitId); } private void OnApplicationPause(bool pauseStatus) { if (!pauseStatus) { AppOpenManager.Instance.ShowAdIfReady(); } } } public class AppOpenManager { #if UNITY_IOS private const string AppOpenAdUnitId = "«iOS-ad-unit-ID»"; #else // UNITY_ANDROID private const string AppOpenAdUnitId = "«Android-ad-unit-ID»"; #endif public void ShowAdIfReady() { if (MaxSdk.IsAppOpenAdReady(AppOpenAdUnitId)) { MaxSdk.ShowAppOpenAd(AppOpenAdUnitId); } else { MaxSdk.LoadAppOpenAd(AppOpenAdUnitId); } } } ``` -------------------------------- ### Get Ad Revenue Performance Source: https://support.axon.ai/en/max/reporting-apis/cohort-api Send a request to the `/maxCohort` endpoint to determine how much revenue users are generating with respect to when they install. ```APIDOC ## GET /maxCohort ### Description Retrieves ad revenue performance data for users based on their installation date. ### Method GET ### Endpoint https://r.applovin.com/maxCohort ### Parameters #### Query Parameters - **api_key** (string) - Required - Your Report Key. - **columns** (string) - Optional - Which columns to report. Comma-separated. - **end** (string) - Optional - Last day you want included in the report, in `YYYY-MM-DD` format. - **filter_«x»** (string) - Optional - Filter column `«x»` by a value. - **format** (string) - Optional - Response format: `csv` or `json`. - **limit** (integer) - Optional - Limit the results set to some fixed number of items. - **not_zero** (integer) - Optional - Set to `1` to filter results in which all numerical metrics have a value of 0. - **offset** (integer) - Optional - Skip the first offset items. You can use this (along with limit) for pagination. - **sort_«x»** (string) - Optional - Sort the response by column `«x»`. `ASC` (ascending) or `DESC` (descending). - **start** (string) - Optional - First day you want included in the report, in `YYYY-MM-DD` format. ### Response #### Success Response (200) - **ads_pub_revenue_«x»** (number) - Revenue generated from ads in `«x»` days since the install. - **ads_rpi_«x»** (number) - Revenue per install generated from ads in `«x»` days since the install. - **application** (string) - Name of the application. - **banner_pub_revenue_«x»** (number) - Revenue generated from banner ads in `«x»` days since the install. - **banner_rpi_«x»** (number) - Revenue per install generated from banner ads in `«x»` days since the install. - **country** (string) - Two-letter ISO Country Code. - **day** (string) - Day of the data, in `YYYY-MM-DD` format. - **iap_pub_revenue_«x»** (number) - Revenue generated from IAP in `«x»` days since the install. - **iap_rpi_«x»** (number) - Revenue per install generated from IAP in `«x»` days since the install. - **installs** (integer) - Number of new installers. - **inter_pub_revenue_«x»** (number) - Revenue generated from (non-rewarded) interstitial ads in `«x»` days since the install. - **inter_rpi_«x»** (number) - Revenue per install generated from (non-rewarded) interstitial ads in `«x»` days since the install. - **mrec_pub_revenue_«x»** (number) - Revenue generated from MREC ads in `«x»` days since the install. - **mrec_rpi_«x»** (number) - Revenue per install generated from MREC ads in `«x»` days since the install. - **package_name** (string) - Package Name/Bundle ID of the application. - **platform** (string) - Platform of the application: `android`, `fireos`, or `ios`. - **pub_revenue_«x»** (number) - Revenue generated in `«x»` days since the install. - **reward_pub_revenue_«x»** (number) - Revenue generated from rewarded ads in `«x»` days since the install. - **reward_rpi_«x»** (number) - Revenue per install generated from rewarded ads in `«x»` days since the install. - **rpi_«x»** (number) - Revenue per install generated in `«x»` days since the install. *Note: `«x»` can be one of: `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `10`, `14`, `18`, `21`, `24`, `27`, `30`, `45`. This API has a request window of 45 days. Make sure the date parameters are in the last 45 days. ``` -------------------------------- ### Basic AppLovin SDK Setup (Groovy) Source: https://support.axon.ai/en/max/android/preparing-mediated-networks A minimal Gradle script for setting up the AppLovin SDK. This includes the necessary repositories and the AppLovin SDK dependency. ```groovy // build.gradle repositories { google() mavenCentral() } dependencies { implementation 'com.applovin:applovin-sdk:+' } ``` -------------------------------- ### Initialize SDK with Configuration Source: https://support.axon.ai/en/max/cordova/overview/data-and-keyword-passing This snippet shows the initialization of the AppLovin MAX SDK with a provided SDK key and a callback function for configuration. ```javascript AppLovinMAX.initialize(«SDK-key», function (configuration) { }); ``` -------------------------------- ### Get Waterfall for a Segment of an Ad Unit Source: https://support.axon.ai/en/max/advanced-features/ad-unit-management-api Make a GET request to `/ad_unit/«ad-unit-ID»/«segment-ID»` to get the waterfall for a segment for an ad unit. ```APIDOC ## GET /ad_unit/«ad-unit-ID»/«segment-ID» ### Description Get the waterfall for a segment for an ad unit. ### Method GET ### Endpoint https://o.applovin.com/mediation/v1/ad_unit/«ad-unit-ID»/«segment-ID» ``` -------------------------------- ### Initialize Custom Adapter Source: https://support.axon.ai/en/max/demand-partners/building-a-custom-adapter Override `initialize` to set up your ad network SDK. Access server parameters via `parameters.getServerParameters()` and report initialization status using `onCompletionListener`. ```java public void initialize(final MaxAdapterInitializationParameters parameters, final Activity activity, final OnCompletionListener onCompletionListener) { // Access server parameters: parameters.getServerParameters().getString("app_id", null ); // Initialize your ad network SDK here... // Report initialization status: onCompletionListener.onCompletion(InitializationStatus.INITIALIZED_SUCCESS, null); } ``` -------------------------------- ### Get Waterfall for a Segment of an Ad Unit Experiment Source: https://support.axon.ai/en/max/advanced-features/ad-unit-management-api Make a GET request to `/ad_unit_experiment/«ad-unit-ID»/«segment_id»` to get the waterfall for a segment for an ad unit experiment. ```APIDOC ## GET /ad_unit_experiment/«ad-unit-ID»/«segment_id» ### Description Get the waterfall for a segment for an ad unit experiment. ### Method GET ### Endpoint https://o.applovin.com/mediation/v1/ad_unit_experiment/«ad-unit-ID»/«segment_id» ``` -------------------------------- ### Initialize SDK and Set Up App Open Ad Event Listeners Source: https://support.axon.ai/en/max/react-native/ad-formats/app-open-ads This snippet shows how to initialize the AppLovin MAX SDK and set up event listeners for App Open Ads. It includes listeners for ad loaded, ad load failed, ad failed to display, and ad hidden events. It also demonstrates how to load an initial ad and handle app state changes to show ads when the app becomes active. ```javascript const App = () => { const appState = useRef(AppState.currentState); useEffect(() => { AppLovinMAX.initialize('«SDK-key»').then((conf: Configuration) => { AppOpenAd.addAdLoadedEventListener((adInfo: AdInfo) => { console.log('AppOpen ad loaded from ' + adInfo.networkName); }); AppOpenAd.addAdLoadFailedEventListener((errorInfo: AdLoadFailedInfo) => { console.log('AppOpen ad failed to load with code ' + errorInfo.code); }); AppOpenAd.addAdFailedToDisplayEventListener((adInfo: AdDisplayFailedInfo) => { AppOpenAd.loadAd(«ad-unit-ID»); }); AppOpenAd.addAdHiddenEventListener((adInfo: AdInfo) => { AppOpenAd.loadAd(«ad-unit-ID»); }); AppOpenAd.loadAd(«ad-unit-ID»); }); AppState.addEventListener("change", nextAppState => { if (appState.current.match(/inactive|background/) && nextAppState === "active") { showAdIfReady(); } appState.current = nextAppState; }); }, []); const showAdIfReady = async () => { const isAppOpenAdReady = await AppOpenAd.isAdReady(«ad-unit-ID»); if (isAppOpenAdReady) { AppOpenAd.showAd(«ad-unit-ID»); } else { AppOpenAd.loadAd(«ad-unit-ID»); } } ⋮ } ``` -------------------------------- ### Enable Ad Review - iOS Setup Source: https://support.axon.ai/en/max/cordova/overview/integration Run the AppLovinQualityServiceSetup-ios.rb script in your project directory to configure Ad Review for iOS. ```bash ruby AppLovinQualityServiceSetup-ios.rb ``` -------------------------------- ### Start Auto-Refresh in Kotlin Source: https://support.axon.ai/en/max/android/ad-formats/banner-and-mrec-ads Starts the auto-refresh for an ad. Ensure auto-refresh is stopped before calling this if needed. ```kotlin adView.startAutoRefresh() ``` -------------------------------- ### Initialize and Load App Open Ad (Objective-C) Source: https://support.axon.ai/en/max/ios/ad-formats/app-open-ads This Objective-C snippet shows how to initialize the AppLovin SDK, create an MAAppOpenAd instance, set its delegate, and load the first ad. It's typically called during application launch. ```Objective-C @interface AppDelegate() @property (nonatomic, strong) MAAppOpenAd *appOpenAd; @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[ALSdk shared] initializeSdkWithCompletionHandler:^(ALSdkConfiguration *configuration) { self.appOpenAd = [[MAAppOpenAd alloc] initWithAdUnitIdentifier: @"«ad-unit-ID»"]; self.appOpenAd.delegate = self; [self.appOpenAd loadAd]; }] return YES; } - (void)applicationDidBecomeActive:(UIApplication *)application { [self showAdIfReady]; } - (void)showAdIfReady { if ( ![[ALSdk shared] isInitialized] ) { return; } if ( [self.appOpenAd isReady] ) { [self.appOpenAd showAdForPlacement: @"«test-placement-ID»"]; } else { [self.appOpenAd loadAd]; } } - (void)didLoadAd:(MAAd *)ad {} - (void)didFailToLoadAdForAdUnitIdentifier:(NSString *)adUnitIdentifier withError:(MAError *)error {} - (void)didDisplayAd:(MAAd *)ad {} - (void)didClickAd:(MAAd *)ad {} - (void)didHideAd:(MAAd *)ad { [self.appOpenAd loadAd]; } - (void)didFailToDisplayAd:(MAAd *)ad withError:(MAError *)error { [self.appOpenAd loadAd]; } @end ``` -------------------------------- ### Start Auto-Refresh in Java Source: https://support.axon.ai/en/max/android/ad-formats/banner-and-mrec-ads Starts the auto-refresh for an ad. Ensure auto-refresh is stopped before calling this if needed. ```java adView.startAutoRefresh(); ``` -------------------------------- ### Start MREC Auto-Refresh Source: https://support.axon.ai/en/max/defold/ad-formats/banner-and-mrec-ads Starts the auto-refresh for a MREC ad. Ensure the ad unit ID is correctly provided. ```lua applovin.start_mrec_auto_refresh(«ad-unit-ID») ``` -------------------------------- ### Configure Gradle Repositories and Dependencies Source: https://support.axon.ai/en/max/cordova/preparing-mediated-networks Set up the necessary repositories (Google and Maven Central) and define the dependencies block in your app/build.gradle.kts file. ```gradle repositories { google() mavenCentral() } dependencies { } ``` -------------------------------- ### Start Banner Auto-Refresh Source: https://support.axon.ai/en/max/defold/ad-formats/banner-and-mrec-ads Starts the auto-refresh for a banner ad. Ensure the ad unit ID is correctly provided. ```lua applovin.start_banner_auto_refresh(«ad-unit-ID») ``` -------------------------------- ### Initialize AppLovin SDK (Java) Source: https://support.axon.ai/en/max/android/overview/integration Initialize the AppLovin SDK with the created configuration object. It's recommended to do this as early as possible, for example, in the `onCreate()` method of your launch activity or Application class, to maximize ad caching. ```java public class MainActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { // Create the initialization configuration AppLovinSdkInitializationConfiguration initConfig = AppLovinSdkInitializationConfiguration.builder( "«SDK-key»" ) .setMediationProvider( AppLovinMediationProvider.MAX ) .build(); // Initialize the SDK with the configuration AppLovinSdk.getInstance( this ).initialize( initConfig, new AppLovinSdk.SdkInitializationListener() { @Override public void onSdkInitialized(final AppLovinSdkConfiguration sdkConfig) { // Start loading ads } } ); } } ``` -------------------------------- ### Start Auto-Refresh for Banner/MREC Ads Source: https://support.axon.ai/en/max/ios/ad-formats/banner-and-mrec-ads Start auto-refresh for a banner or MREC ad. This is a simple call to resume the automatic ad refresh. ```Objective-C [adView startAutoRefresh]; ``` -------------------------------- ### Get Test Device Details Source: https://support.axon.ai/en/max/advanced-features/ad-unit-management-api Make a GET request to `/test_device/«test-device-ID»` to view details about a particular test device. ```APIDOC ## GET /test_device/«test-device-ID» ### Description View details about a particular test device. ### Method GET ### Endpoint https://o.applovin.com/mediation/v1/test_device/«test-device-ID» ``` -------------------------------- ### Initialize Banner Ad in Defold Source: https://support.axon.ai/en/max/defold/ad-formats/banner-and-mrec-ads Loads a banner ad by calling `create_banner()`. Pass your Ad Unit ID and desired position. Banners are automatically sized. Ensure to set a background color for full functionality. ```lua local banner_ad_unit_ids = { android = "«android-ad-unit-ID»", ios = "«ios-ad-unit-ID»" } function initialize_banner_ads() local ad_unit_id local sysinfo = sys.get_sys_info() if sysinfo.system_name == "Android" then ad_unit_id = banner_ad_unit_ids["android"] elseif sysinfo.system_name == "iPhone OS" then ad_unit_id = banner_ad_unit_ids["ios"] end -- Banners are automatically sized to 320x50 on phones and 728x90 on tablets applovin.create_banner(ad_unit_id, "bottom_center") -- Set background color for banners to be fully functional -- this sets it to black - USE HEX STRINGS ONLY applovin.set_banner_background_color(ad_unit_id, "#000000"); ``` -------------------------------- ### Get Ad Unit Details Source: https://support.axon.ai/en/max/advanced-features/ad-unit-management-api Make a GET request to `/ad_unit/«ad-unit-ID»` to view details about a particular ad unit. ```APIDOC ## GET /ad_unit/«ad-unit-ID» ### Description View details about a particular ad unit. ### Method GET ### Endpoint https://o.applovin.com/mediation/v1/ad_unit/«ad-unit-ID» ``` -------------------------------- ### Load Rewarded Ad and Implement Listener (Java) Source: https://support.axon.ai/en/max/android/ad-formats/rewarded-ads Demonstrates how to initialize and load a rewarded ad, and implement the `MaxRewardedAdListener` interface to handle ad events like loading, failure, display, and user rewards. Includes logic for retrying ad loads on failure. ```java public class ExampleActivity extends Activity implements MaxRewardedAdListener { private MaxRewardedAd rewardedAd; private int retryAttempt; void createRewardedAd() { rewardedAd = MaxRewardedAd.getInstance( "«ad-unit-ID»", this ); rewardedAd.setListener( this ); rewardedAd.loadAd(); } // MAX Ad Listener @Override public void onAdLoaded(final MaxAd maxAd) { // Rewarded ad is ready to be shown. rewardedAd.isReady() will now return 'true' // Reset retry attempt retryAttempt = 0; } @Override public void onAdLoadFailed(final String adUnitId, final MaxError 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) retryAttempt++; long delayMillis = TimeUnit.SECONDS.toMillis( (long) Math.pow( 2, Math.min( 6, retryAttempt ) ) ); new Handler().postDelayed( new Runnable() { @Override public void run() { rewardedAd.loadAd(); } }, delayMillis ); } @Override public void onAdDisplayFailed(final MaxAd maxAd, final MaxError error) { // Rewarded ad failed to display. AppLovin recommends that you load the next ad. rewardedAd.loadAd(); } @Override public void onAdDisplayed(final MaxAd maxAd) {} @Override public void onAdClicked(final MaxAd maxAd) {} @Override public void onAdHidden(final MaxAd maxAd) { // rewarded ad is hidden. Pre-load the next ad rewardedAd.loadAd(); } @Override public void onUserRewarded(final MaxAd maxAd, final MaxReward maxReward) { // Rewarded ad was displayed and user should receive the reward } } ``` -------------------------------- ### Start MREC Auto-Refresh (Programmatic) Source: https://support.axon.ai/en/max/flutter/ad-formats/banner-and-mrec-ads Start the auto-refresh for an MREC ad using its ad unit ID. This resumes automatic ad loading. ```dart AppLovinMAX.startMRecAutoRefresh(«ad-unit-ID»); ``` -------------------------------- ### Initialize Custom Adapter Source: https://support.axon.ai/en/max/demand-partners/building-a-custom-adapter Implement the `initializeWithParameters:completionHandler:` method to initialize your ad network SDK. Retrieve the app ID from `parameters.serverParameters[@"app_id"]`. Call the completion handler with the appropriate initialization status. ```Objective-C - (void)initializeWithParameters:(id)parameters completionHandler:(void (^)(MAAdapterInitializationStatus, NSString *_Nullable))completionHandler ``` -------------------------------- ### Start Banner Auto-Refresh (Programmatic) Source: https://support.axon.ai/en/max/flutter/ad-formats/banner-and-mrec-ads Start the auto-refresh for a banner ad using its ad unit ID. This resumes automatic ad loading. ```dart AppLovinMAX.startBannerAutoRefresh(«ad-unit-ID»); ``` -------------------------------- ### Basic Gradle Configuration (Groovy) Source: https://support.axon.ai/en/max/react-native/preparing-mediated-networks This is a minimal build.gradle file in Groovy syntax, showing only the essential repositories and an empty dependencies block. It serves as a base for adding specific ad network configurations. ```groovykotlin // build.gradle repositories { google() mavenCentral() } dependencies { } ``` -------------------------------- ### JSON Response Example Source: https://support.axon.ai/en/max/reporting-apis/revenue-reporting-api Example of a JSON formatted response from the Revenue Reporting API. This format is used when the 'format=json' parameter is included in the request. ```json { "code": 200, "results": [ { "day": "2019-03-25", "hour": "00:00", "application": "My Test App", "impressions": "987654" }, { "day": "2019-03-25", "hour": "01:00", "application": "My Test App", "impressions": "819127" } ], "count": 2 } ``` -------------------------------- ### CSV Response Example Source: https://support.axon.ai/en/max/reporting-apis/revenue-reporting-api Example of a CSV formatted response from the Revenue Reporting API. This format is used when the 'format=csv' parameter is included in the request. ```csv day,hour,application,impressions 2019-03-25,00:00,"My Test App",987654 2019-03-25,01:00,"My Test App",819127 ``` -------------------------------- ### Configure Ad Placer Settings in Java Source: https://support.axon.ai/en/max/advanced-features/s2s-impression-level-api Initialize MaxAdPlacerSettings with an ad unit ID and set the desired placement. Replace placeholders with your actual ad unit ID and placement. ```java MaxAdPlacerSettings settings = new MaxAdPlacerSettings( "«ad-unit-ID»" ); settings.setPlacement( "«placement»" ); ``` -------------------------------- ### CSV Response Format Example Source: https://support.axon.ai/en/max/reporting-apis/cohort-api Example of a CSV formatted response from the Cohort API. This format is suitable for direct import into spreadsheet software. ```csv day,country,application,installs,pub_revenue_7 2019-03-25,gb,"My Test App",142,81.24 2019-03-25,in,"My Test App",921,59.25 ``` -------------------------------- ### Initialize AppLovin SDK and App Open Manager Source: https://support.axon.ai/en/max/android/ad-formats/app-open-ads Initialize the AppLovin SDK and set up the App Open Manager in your Application class. This should be done once when the application starts. ```kotlin class MyApplication : Application() { private lateinit var appOpenManager: ExampleAppOpenManager override fun onCreate() { super.onCreate() AppLovinSdk.getInstance( this ).initializeSdk({ configuration: AppLovinSdkConfiguration -> appOpenManager = ExampleAppOpenManager(applicationContext) }) } } ``` -------------------------------- ### Create and Load a Banner Ad (Java) Source: https://support.axon.ai/en/max/android/ad-formats/banner-and-mrec-ads This Java code demonstrates how to create, configure, and load a banner ad. Ensure the ad unit ID and background color are set correctly. The ad view is stretched to match the screen width and configured with a specific height. ```java public class ExampleActivity extends Activity implements MaxAdViewAdListener { private MaxAdView adView; void createBannerAd() { adView = new MaxAdView( "«ad-unit-ID»", this ); adView.setListener( this ); // Stretch to the width of the screen for banners to be fully functional int width = ViewGroup.LayoutParams.MATCH_PARENT; // Banner height on phones and tablets is 50 and 90, respectively int heightPx = getResources().getDimensionPixelSize( R.dimen.banner_height ); adView.setLayoutParams( new FrameLayout.LayoutParams( width, heightPx ) ); // Set background color for banners to be fully functional adView.setBackgroundColor( «background-color» ); ViewGroup rootView = findViewById( android.R.id.content ); rootView.addView( adView ); // Load the ad adView.loadAd(); } // MAX Ad Listener @Override public void onAdLoaded(final MaxAd maxAd) {} @Override public void onAdLoadFailed(final String adUnitId, final MaxError error) {} @Override public void onAdDisplayFailed(final MaxAd maxAd, final MaxError error) {} @Override public void onAdClicked(final MaxAd maxAd) {} @Override public void onAdExpanded(final MaxAd maxAd) {} @Override public void onAdCollapsed(final MaxAd maxAd) {} @Override public void onAdDisplayed(final MaxAd maxAd) { /* DO NOT USE - THIS IS RESERVED FOR FULLSCREEN ADS ONLY AND WILL BE REMOVED IN A FUTURE SDK RELEASE */ } @Override public void onAdHidden(final MaxAd maxAd) { /* DO NOT USE - THIS IS RESERVED FOR FULLSCREEN ADS ONLY AND WILL BE REMOVED IN A FUTURE SDK RELEASE */ } } ``` -------------------------------- ### Ad Unit Response Body Example Source: https://support.axon.ai/en/max/advanced-features/ad-unit-management-api Example JSON response body for the `/ad_units` endpoint, showing details of two ad units. ```json [ { "name": "My Inter Ad Unit", "platform": "ios", "package_name": "com.test.app", "ad_format": "INTER", "id": "45de6aa565cf865f", "has_active_experiment": false, "disabled": false }, { "name": "My Rewarded Ad Unit", "platform": "android", "package_name": "com.test.app", "ad_format": "REWARD", "id": "565c45df8e6aa65f", "has_active_experiment": false, "disabled": false } ] ``` -------------------------------- ### Configure Repositories and AppLovin SDK Source: https://support.axon.ai/en/max/android/preparing-mediated-networks Set up the necessary repositories and add the AppLovin SDK dependency in your project's `build.gradle.kts` file. This ensures your project can access the required libraries. ```kotlin repositories { google() mavenCentral() } dependencies { implementation("com.applovin:applovin-sdk:+") } ``` -------------------------------- ### Create MAAdPlacerSettings (Swift) Source: https://support.axon.ai/en/max/ios/ad-formats/native-ads Initialize MAAdPlacerSettings with your ad unit identifier to configure the ad placer and its positioning. ```Swift let settings = MAAdPlacerSettings(adUnitIdentifier: "«ad-unit-ID»") ``` -------------------------------- ### Countries Object Example Source: https://support.axon.ai/en/max/advanced-features/ad-unit-management-api An example of the `countries` object used within frequency capping or ad network ad units, specifying country inclusion. ```json { "type": "INCLUDE", "values" : [ "ca", "us" ] } ``` -------------------------------- ### Create and Load a Banner Ad (Kotlin) Source: https://support.axon.ai/en/max/android/ad-formats/banner-and-mrec-ads This Kotlin code demonstrates how to create, configure, and load a banner ad. Ensure the ad unit ID and background color are set correctly. The ad view is stretched to match the screen width and configured with a specific height. ```kotlin class ExampleActivity : Activity(), MaxAdViewAdListener { private var adView: MaxAdView? = null fun createBannerAd() { adView = MaxAdView("«ad-unit-ID»", this) adView?.setListener(this) // Stretch to the width of the screen for banners to be fully functional val widthPx = ViewGroup.LayoutParams.MATCH_PARENT // Banner height on phones and tablets is 50 and 90, respectively val heightPx = resources.getDimensionPixelSize(R.dimen.banner_height) adView?.layoutParams = FrameLayout.LayoutParams(widthPx, heightPx) // Set background color for banners to be fully functional adView?.setBackgroundColor(«background-color») val rootView = findViewById(android.R.id.content) rootView.addView(adView) // Load the ad adView?.loadAd() } // MAX Ad Listener override fun onAdLoaded(maxAd: MaxAd) {} override fun onAdLoadFailed(adUnitId: String?, error: MaxError?) {} override fun onAdDisplayFailed(ad: MaxAd?, error: MaxError?) {} override fun onAdClicked(maxAd: MaxAd) {} override fun onAdExpanded(maxAd: MaxAd) {} override fun onAdCollapsed(maxAd: MaxAd) {} override fun onAdDisplayed(maxAd: MaxAd) { /* DO NOT USE - THIS IS RESERVED FOR FULLSCREEN ADS ONLY AND WILL BE REMOVED IN A FUTURE SDK RELEASE */ } override fun onAdHidden(maxAd: MaxAd) { /* DO NOT USE - THIS IS RESERVED FOR FULLSCREEN ADS ONLY AND WILL BE REMOVED IN A FUTURE SDK RELEASE */ } } ``` -------------------------------- ### Ad Unit Response Body Example Source: https://support.axon.ai/en/max/advanced-features/ad-unit-management-api Example of a response body when retrieving ad unit details, including device type and segment keys. ```json { "device_type": "tablets", "segment_keys": [ [ "+1:2" ] ] } ``` -------------------------------- ### Initialize AppLovin SDK in Swift Source: https://support.axon.ai/en/max/ios/overview/integration Initialize the SDK with a configuration object including your SDK key and mediation provider. This should be done at application startup. ```Swift func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { let initConfig = ALSdkInitializationConfiguration(sdkKey: "«SDK-key»") { builder in builder.mediationProvider = ALMediationProviderMAX } // Initialize the SDK with the configuration ALSdk.shared().initialize(with: initConfig) { sdkConfig in // Start loading ads } ⋮ ``` -------------------------------- ### Initialize Banner Ads (C++) Source: https://support.axon.ai/en/max/unreal/ad-formats/banner-and-mrec-ads Load a banner ad by calling `CreateBanner()`. Banners are automatically sized based on device type. Ensure to set a background color for full functionality. ```cpp const FString BannerAdUnitId = TEXT("«ad-unit-ID»"); void InitializeBannerAds() { // Banners are automatically sized to 320×50 on phones and 728×90 on tablets // You may call the utility method UAppLovinMAX::IsTablet() to help with view sizing adjustments UAppLovinMAX::CreateBanner(BannerAdUnitId, EAdViewPosition::BottomCenter); // Set background color for banners to be fully functional UAppLovinMAX::SetBannerBackgroundColor(BannerAdUnitId, «banner-background-color»); } ``` -------------------------------- ### Install React Native AppLovin MAX Module Source: https://support.axon.ai/en/max/react-native/overview/integration Use npm to install the AppLovin MAX React Native module. Subscribe to the GitHub repository for release updates. ```bash npm install react-native-applovin-max ``` -------------------------------- ### Initialize MAX SDK in Unity Source: https://support.axon.ai/en/max/unity/overview/integration Attach the OnSdkInitializedEvent handler and initialize the SDK on app launch. This ensures mediated networks can cache ad assets, which is crucial for video ads. ```csharp MaxSdkCallbacks.OnSdkInitializedEvent += (MaxSdk.SdkConfiguration sdkConfiguration) => { // AppLovin SDK is initialized, start loading ads }; MaxSdk.InitializeSdk(); ```