Skip to content

Amazon Publisher Services Integration Instructions

Add the Amazon Publisher Services Adapter Plugin

Download and import the APS Unity plugin from Amazon Publisher Services.

To install or upgrade the Amazon Publisher Services adapter, select Amazon > Manage SDKs from the Unity menu bar. When the Amazon SDK Manager appears, click Install next to AppLovin MAX.

Amazon SDK Manager: Mediated Networks. AppLovin MAX.

Initialize the Amazon SDK

The Amazon Publisher Services SDK requires that you initialize it outside of MAX SDK:

Amazon.Initialize(amazonAppId);
Amazon.SetAdNetworkInfo(new AdNetworkInfo(DTBAdNetwork.MAX));

Load a Banner or MREC Ad from Amazon’s SDK

To integrate Amazon banner or MREC ads into MAX, you must load the Amazon ad first. Before you create the MAX banner or MREC ad, pass the response object into MaxSdk. You can do this by calling MaxSdk#SetBannerLocalExtraParameter() or MaxSdk#SetMRecLocalExtraParameter()

public class MainMenu : MonoBehaviour
{
private void loadAd()
{
int width;
int height;
string slotId;
if (MaxSdkUtils.IsTablet())
{
width = 728;
height = 90;
slotId = "«Amazon-leader-slot-ID»";
}
else
{
width = 320;
height = 50;
slotId = "«Amazon-banner-slot-ID»";
}
var apsBanner = new APSBannerAdRequest(width, height, slotId);
apsBanner.onSuccess += (adResponse) =>
{
MaxSdk.SetBannerLocalExtraParameter(«ad-unit-ID», "amazon_ad_response", adResponse.GetResponse());
CreateMaxBannerAd();
};
apsBanner.onFailedWithError += (adError) =>
{
MaxSdk.SetBannerLocalExtraParameter(«ad-unit-ID», "amazon_ad_error", adError.GetAdError());
CreateMaxBannerAd();
};
apsBanner.LoadAd();
}
private void CreateMaxBannerAd()
{
MaxSdk.CreateBanner(«ad-unit-ID», MaxSdkBase.BannerPosition.BottomCenter);
MaxSdk.SetBannerPlacement(«ad-unit-ID», "«placement»");
}
}

Load an Interstitial Ad from Amazon’s SDK

To integrate Amazon interstitial ads into MAX, you must load the Amazon ad first. Before you create the MAX intersitital ad, pass the response object into MaxSdk. You can do this by calling MaxSdk#SetInterstitialLocalExtraParameter()

public class MainMenu : MonoBehaviour
{
private bool IsFirstLoad = true;
private void LoadAd()
{
if (IsFirstLoad)
{
IsFirstLoad = false;
var interstitialAd = new APSInterstitialAdRequest(«Amazon-inter-slot-ID»);
interstitialAd.onSuccess += (adResponse) =>
{
MaxSdk.SetInterstitialLocalExtraParameter(«ad-unit-ID», "amazon_ad_response", adResponse.GetResponse());
MaxSdk.LoadInterstitial(«ad-unit-ID»);
};
interstitialAd.onFailedWithError += (adError) =>
{
MaxSdk.SetInterstitialLocalExtraParameter(«ad-unit-ID», "amazon_ad_error", adError.GetAdError());
MaxSdk.LoadInterstitial(«ad-unit-ID»);
};
interstitialAd.LoadAd();
}
else
{
MaxSdk.LoadInterstitial(«ad-unit-ID»);
}
}
}

Load a Rewarded Video Ad from Amazon’s SDK

To integrate Amazon rewarded video ads into MAX, you must load the Amazon ad first. Before you load the MAX ad, pass the response object into MaxSdk. You can do this by calling MaxSdk#SetRewardedAdLocalExtraParameter()

public class MainMenu : MonoBehaviour
{
private bool IsFirstLoad = true;
private void LoadAd()
{
if (IsFirstLoad)
{
IsFirstLoad = false;
var rewardedVideoAd = new APSVideoAdRequest(320, 480, «Amazon-video-rewarded-slot-ID»);
rewardedVideoAd.onSuccess += (adResponse) =>
{
MaxSdk.SetRewardedAdLocalExtraParameter(«ad-unit-ID», "amazon_ad_response", adResponse.GetResponse());
MaxSdk.LoadRewardedAd(«ad-unit-ID»);
};
rewardedVideoAd.onFailedWithError += (adError) =>
{
MaxSdk.SetRewardedAdLocalExtraParameter(«ad-unit-ID», "amazon_ad_error", adError.GetAdError());
MaxSdk.LoadRewardedAd(«ad-unit-ID»);
};
rewardedVideoAd.LoadAd();
}
else
{
MaxSdk.LoadRewardedAd(«ad-unit-ID»);
}
}
}

Testing Amazon Publisher Services

AppLovin recommends that you enable test mode for Amazon’s SDK. When you do, you receive test ads. Enable test mode with the following calls:

Amazon.EnableLogging(true);
Amazon.EnableTesting(true);