Unity Ads Network Integration in Mobile Application
Unity Ads is an advertising network more often chosen for gaming applications. Reason: advertisers in the Unity network are mainly game studios, which provides high eCPM for gaming audiences. For non-gaming applications, Unity Ads typically loses to AdMob in fill rate.
SDK Initialization
Unity Ads SDK 4.x (current as of 2024):
// Android
UnityAds.initialize(context, "GAME_ID", isTestMode, object : IUnityAdsInitializationListener {
override fun onInitializationComplete() {
// SDK is ready, load ad units
loadInterstitial()
}
override fun onInitializationFailed(error: UnityAds.UnityAdsInitializationError, message: String) {
Log.e("UnityAds", "Init failed: $message")
}
})
isTestMode = true is mandatory during development. Real ads in test mode are not shown — this protects against accidental production ad display in dev builds.
Rewarded Video — Main Format
Unity Ads specializes in rewarded video. Loading and showing pattern:
fun loadAd() {
UnityAds.load("rewardedVideo", object : IUnityAdsLoadListener {
override fun onUnityAdsAdLoaded(placementId: String) {
isAdReady = true
}
override fun onUnityAdsFailedToLoad(
placementId: String,
error: UnityAds.UnityAdsLoadError,
message: String
) {
// Retry after 30 seconds or fallback to another network
}
})
}
fun showAd(activity: Activity) {
if (!isAdReady) return
UnityAds.show(activity, "rewardedVideo", object : IUnityAdsShowListener {
override fun onUnityAdsShowComplete(
placementId: String,
state: UnityAds.UnityAdsShowCompletionState
) {
if (state == UnityAds.UnityAdsShowCompletionState.COMPLETED) {
grantReward() // Award only on COMPLETED, not on SKIPPED
}
}
})
}
SKIPPED — user closed early; COMPLETED — watched to the end. Award only for COMPLETED — requirement of Unity and common sense.
Placement IDs and Configuration
Placement IDs are created in Unity Dashboard (dashboard.unity3d.com). Typical placements: rewardedVideo, interstitial, banner. For each placement, ad type, eCPM floor, and display frequency are configured.
Unity Ads Place in Mediation
Optimal architecture for gaming applications: AdMob mediation + Unity Ads adapter. AdMob requests Unity Ads through mediation and selects highest eCPM. Native Unity Ads integration is justified only if AdMob is not suitable (for example, app developed in Unity Engine and already using Unity Gaming Services).
GDPR
Unity Ads supports UnityAds.setPrivacyConsent() and metadata via MetaData:
val gdprMetadata = MetaData(context)
gdprMetadata["gdpr.consent"] = true
gdprMetadata.commit()
Without explicit consent in EU — Unity shows non-targeted ads with reduced eCPM.
Timelines — 1–3 days: SDK initialization, placement setup, GDPR consent flow, testing on real devices.







