Unity SDK Configuration
Initialization
Pass an EmpowerAdsConfig to EmpowerAds.Initialize(). Subscribe to events before calling Initialize() so you don't miss early callbacks.
using Empower.MobileAds;
// Separate identifiers for Android and iOS (recommended)
var config = new EmpowerAdsConfig(
android: "your_android_app_id",
iOS: "your_ios_app_id"
)
{
DebugMode = false, // extra native logging (disable in production)
LogLevel = EmpowerLogLevel.Default,// All | Default | Warning | Error | None
PrivacyMode = PrivacyMode.Automatic, // Automatic | NonPersonalized | Manual
Variant = null, // optional A/B test variant
};
// Or a single identifier if both platforms share one
var config = new EmpowerAdsConfig("shared_app_identifier");
EmpowerAds.Initialize(config);
| Property | Type | Default | Description |
|---|---|---|---|
AndroidAppAdIdentifier | string | (required*) | Android app identifier from the Empower dashboard. |
IOSAppAdIdentifier | string | (required*) | iOS app identifier from the Empower dashboard. |
AppAdIdentifier | string | (read-only) | Returns the identifier for the current platform. |
DebugMode | bool | false | Verbose native logging. Disable in production. |
LogLevel | EmpowerLogLevel | Default | All, Default, Warning, Error, None. |
PrivacyMode | PrivacyMode | Automatic | See Privacy and Consent. |
Variant | string | null | Optional string for A/B testing. |
* At least one platform identifier is required for the platform you build for.
Event Handling
All events are static C# events on EmpowerAds. Subscribe before Initialize(), and always unsubscribe in OnDestroy() (static events hold references to your MonoBehaviour and can leak).
| Event | Signature | When |
|---|---|---|
OnSdkReady | Action | SDK initialized. Safe to load ads. |
OnSdkFailed | Action<string> | Initialization failed (string = error). |
OnBannerStatusChanged | Action<AdStatus, string> | Banner status changed (2nd param = zone ID). |
OnInterstitialStatusChanged | Action<AdStatus, string> | Interstitial status changed. |
OnRewardedStatusChanged | Action<AdStatus, string> | Rewarded status changed. |
OnAppOpenStatusChanged | Action<AdStatus, string> | App-open status changed. |
OnPrerollStatusChanged | Action<AdStatus, string> | Preroll status changed. |
OnPrerollEvent | Action<string, string, string> | Preroll lifecycle event: eventName, zoneId, error. |
void OnDestroy()
{
EmpowerAds.OnSdkReady -= OnSdkReady;
EmpowerAds.OnInterstitialStatusChanged -= OnInterstitialStatus;
// ... unsubscribe from every event you subscribed to
}
Always filter by zone ID in status handlers:
EmpowerAds.OnInterstitialStatusChanged += (status, zoneId) =>
{
if (zoneId != myZoneId) return;
// handle status...
};
AdStatus Values
| Value | Meaning |
|---|---|
Undefined | Default / unknown. |
Initializing | The ad is being prepared. |
Ready | Loaded and ready to show (or visible, for banners). |
Failed | Failed to load or show. |
WillLeave | The user is about to leave the app (e.g. opening a browser). |
Shown | The ad is currently displayed. |
CompletePlaying | Video playback finished. |
Rewarded | The user earned a rewarded-video reward. Grant the reward here. |
Skipped | Dismissed without earning a reward (rewarded), or a full-screen dismissal. Reload here. |
Closed | Full-screen ad dismissed (rewarded: after earning). Reload here. |
Clicked | The user tapped the ad. |
Impression | An impression was recorded. |
Active | The ad is actively playing (preroll). |
Used | The ad has been consumed. |
On iOS, a full-screen ad dismisses as
Skippedwhen the user closes it without a reward, and asClosedotherwise. Handle both when reloading.
Privacy and Consent (GDPR)
Set the privacy mode in EmpowerAdsConfig before initialization.
| Mode | Behavior |
|---|---|
Automatic | The SDK runs the UMP consent flow (and ATT on iOS) automatically when required. Recommended for most apps. |
NonPersonalized | All ads are non-personalized; no consent dialog is shown. |
Manual | You drive consent yourself via RequestConsent(). |
Requesting Consent Manually (PrivacyMode.Manual)
EmpowerAds.RequestConsent(granted =>
{
// The SDK persists the outcome (via Google UMP); no follow-up call needed.
Debug.Log($"Consent flow completed: {granted}");
});
Privacy Options Form
GDPR requires users can change consent at any time. Add a "Manage Privacy" button to your settings screen:
if (EmpowerAds.IsPrivacyOptionsRequired())
{
// show your button, and when tapped:
EmpowerAds.ShowPrivacyOptionsForm(accepted =>
Debug.Log($"Privacy form result: {accepted}"));
}
Runtime Settings
// Disable / re-enable all ad serving (e.g. for premium users)
EmpowerAds.SetAdsDisabled(true);
// Toggle debug mode and log level
EmpowerAds.SetDebugMode(true);
EmpowerAds.SetLogLevel(EmpowerLogLevel.Error);
// Query state
bool ready = EmpowerAds.IsSdkInitialized();
// Shut down and release resources
EmpowerAds.Shutdown();