Skip to content

Unity Plugin - API reference

Methods, events, types and errors of the MDN11 Unity plugin. Everything is called through the static class A11MediationSDK in the Aurion11.A11Mediation namespace.

SDK

Initialization

Member Description
Initialize(appKey, hostUrls) Initialize the SDK. Call once at startup, before loading any ads. hostUrls is a string[] of host URLs provided by Aurion11.
InitializeWithStaticConfig(appKey, staticConfig) Initialize with a publisher-provided JSON config string, skipping the remote fetch. See Static configuration.
InitializeWithSeedConfig(appKey, seedConfig, hostUrls) Android only. Initialize from seedConfig, then fetch the remote config from hostUrls in the background. On iOS the seed config is ignored and the SDK initializes from hostUrls alone. See Seed configuration.
SetTestAds(bool) Enable SDK test mode. Call before Initialize() or InitializeWithStaticConfig(). See Test ads.
SetLogsEnabled(bool) Enable [A11] plugin logs. Disabled by default; call before Initialize() to capture the full initialization. See Logging.
InvokeEventsOnUnityMainThread: bool? When events are raised. null (default): lifecycle events are queued to the Unity main thread, revenue events are raised immediately. true: all events queued. false: all events raised immediately. See Event threading.
PluginVersion: string Current plugin version.

Privacy

All privacy methods must be called before Initialize().

Method Description
SetUserConsent(A11UserConsent) GDPR / LGPD per-vendor consent map. See A11UserConsent example.
SetDoNotSell(bool) CCPA opt-out signal. true = user has opted out of data sale.
SetChildDirected(bool) COPPA flag. true = app is directed at children. Cannot be changed after init.

For a full list of which networks require direct publisher action on privacy, see the Network privacy reference.

Publisher signals

Method Description
SetUserId(string) Publisher-defined user ID. See Publisher-provided user ID.
SetIsPaidUser(bool) Whether the user has made a purchase.

Ad formats

Every method takes the ad unit ID as its first argument. A null ad unit ID is logged and ignored.

Method Description
LoadBanner(adUnitId, position, size) Load a banner. position defaults to A11BannerPosition.Bottom, size to A11BannerSize.Standard. Choose the size before loading.
ShowBanner(adUnitId) Show the loaded banner.
HideBanner(adUnitId) Hide the banner without destroying it.
DestroyBanner(adUnitId) Destroy the banner and release its resources.

Interstitial

Method Description
LoadInterstitial(adUnitId) Load an interstitial.
ShowInterstitial(adUnitId) Present the interstitial.

Rewarded

Method Description
LoadRewarded(adUnitId) Load a rewarded ad.
ShowRewarded(adUnitId) Present the rewarded ad.

MREC

Method Description
LoadMrec(adUnitId, position) Load an MREC. position defaults to A11BannerPosition.Bottom.
ShowMrec(adUnitId) Show the loaded MREC.
HideMrec(adUnitId) Hide the MREC without destroying it.
DestroyMrec(adUnitId) Destroy the MREC and release its resources.

All formats

Member Description
SetCustomParameters(adUnitId, parameters) Network-specific key-value pairs for an ad unit, as Dictionary<string, Dictionary<string, object>> keyed by namespace ("aurion11", "google_ad_manager", "applovin"). Persist across loads until overwritten; pass an empty dictionary to clear.
GetBestLoadedAd(adUnitId): A11AdInfo Snapshot of the best ad held for the ad unit, or null if none. Safe to call every frame. See Best loaded ad.
OnBestLoadedAdChanged Raised when the best ad held for an ad unit changes. A11AdInfo is null when the unit no longer holds an ad.
NotifyLossToExternal(adUnitId, price) Report that an impression for this ad unit went to an ad source outside the SDK. price is the eCPM as double?; omit it when unknown. See External loss reporting.

Ad events

Each format raises the same set of events, named after the format: replace <Format> with Interstitial, Rewarded, Banner or Mrec, e.g. OnInterstitialLoaded. Every event passes the ad unit ID as its first argument.

Event Arguments Description
On<Format>Loaded string, A11AdInfo An ad finished loading.
On<Format>LoadFailed string, A11AdLoadError Loading failed. See Load errors.
On<Format>Shown string, A11AdInfo The ad was shown.
On<Format>ShowFailed string, A11AdInfo, A11AdShowError Showing failed. See Show errors.
On<Format>Clicked string, A11AdInfo The user clicked the ad.
On<Format>Closed string, A11AdInfo Interstitial and rewarded only. The ad was closed. Banner and MREC never raise it.
On<Format>Revenue string, A11AdInfo Impression-level revenue for the ad. Raised immediately by default, without waiting for the Unity main thread; see Event threading.
OnRewardedEarned string, A11AdInfo Rewarded only. The user earned the reward; grant it here.

Caution

By default, revenue events (OnInterstitialRevenue and the other On*Revenue events) fire immediately, so they're delivered even while a full-screen ad is covering your game. On Android they run outside Unity's main thread. In revenue handlers, only use thread-safe code, such as forwarding the revenue to your analytics SDK. Don't update UI or GameObjects there.

Ad data

A11AdInfo

Passed to every ad event, and returned by GetBestLoadedAd().

Property Type Description
AdCallId string Unique ID for this ad call.
SdkAdapter string Name of the SDK adapter that served the ad.
SdkPlacementId string SdkAdapter's own placement id (e.g. an AdMob ad unit id, an AppLovin zone id) - null when the adapter exposes none.
Network string Ad network that served the ad.
Revenue double Monetary value of the impression.
RevenueCurrency string Currency code for Revenue.
ValuationMethod A11ValuationMethod How Revenue was arrived at.
ExtraParametersJson string Adapter-specific load-response data as a raw JSON object string, keyed by network - null when the adapter provides none. Key names can differ between Android and iOS.

A11ValuationMethod

Value Description
Precise The exact price the winning buyer paid, as reported by the network.
Estimated An estimate rather than a cleared price.
Provided A fixed rate configured on the network's side.
Unknown No valuation method was reported.

A11BannerSize

Member Description
Standard Fixed 320x50 dp banner. The default.
AnchoredAdaptive(widthDp) The network calculates the height for the device. widthDp is optional.
InlineAdaptive(widthDp, maxHeightDp) Adaptive banner inside scrolling content. Both arguments are optional.

On iOS both adaptive sizes use the SDK's single adaptive mode, and widthDp / maxHeightDp are ignored. See Banner sizes.

A11BannerPosition

Value Description
Bottom Anchored to the bottom of the screen. The default.
Top Anchored to the top of the screen.

A11UserConsent

Member Description
A11UserConsent(jurisdiction, consents) Create consent for an A11Jurisdiction (GDPR or LGPD) with a Dictionary<string, bool> of vendor keys.
Jurisdiction: A11Jurisdiction Privacy jurisdiction this consent applies to.
Consents: Dictionary<string, bool> Consent per vendor key, e.g. "GoogleAdmob", "AppLovin".

Errors

Load errors

A11AdLoadError, passed to On<Format>LoadFailed.

Error Meaning
WrongAppKey App key not recognized by the backend.
MissingConfig No waterfall configuration returned.
InvalidAdUnit Ad unit ID not found in configuration.
MissingSelectors Missing selectors in configuration.
MissingAdapters Missing adapters in configuration.
NoFill No network returned an ad. Retry with backoff.
Network Network or server error.
NoNetwork Device has no internet connection.
Timeout Ad request timed out.
Interrupted Ad loading was interrupted (e.g. app in background). Android only.
Other Unclassified error.
Unknown The native SDK reported an error the plugin does not recognize.

Show errors

A11AdShowError, passed to On<Format>ShowFailed.

Error Meaning
AdNotReady Show called before the ad finished loading.
AdExpired Ad was loaded too long ago - reload before showing.
AlreadyShowing Not currently reported by either platform.
Other Unclassified error.
Unknown The native SDK reported an error the plugin does not recognize.