Skip to main content

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);
PropertyTypeDefaultDescription
AndroidAppAdIdentifierstring(required*)Android app identifier from the Empower dashboard.
IOSAppAdIdentifierstring(required*)iOS app identifier from the Empower dashboard.
AppAdIdentifierstring(read-only)Returns the identifier for the current platform.
DebugModeboolfalseVerbose native logging. Disable in production.
LogLevelEmpowerLogLevelDefaultAll, Default, Warning, Error, None.
PrivacyModePrivacyModeAutomaticSee Privacy and Consent.
VariantstringnullOptional 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).

EventSignatureWhen
OnSdkReadyActionSDK initialized. Safe to load ads.
OnSdkFailedAction<string>Initialization failed (string = error).
OnBannerStatusChangedAction<AdStatus, string>Banner status changed (2nd param = zone ID).
OnInterstitialStatusChangedAction<AdStatus, string>Interstitial status changed.
OnRewardedStatusChangedAction<AdStatus, string>Rewarded status changed.
OnAppOpenStatusChangedAction<AdStatus, string>App-open status changed.
OnPrerollStatusChangedAction<AdStatus, string>Preroll status changed.
OnPrerollEventAction<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

ValueMeaning
UndefinedDefault / unknown.
InitializingThe ad is being prepared.
ReadyLoaded and ready to show (or visible, for banners).
FailedFailed to load or show.
WillLeaveThe user is about to leave the app (e.g. opening a browser).
ShownThe ad is currently displayed.
CompletePlayingVideo playback finished.
RewardedThe user earned a rewarded-video reward. Grant the reward here.
SkippedDismissed without earning a reward (rewarded), or a full-screen dismissal. Reload here.
ClosedFull-screen ad dismissed (rewarded: after earning). Reload here.
ClickedThe user tapped the ad.
ImpressionAn impression was recorded.
ActiveThe ad is actively playing (preroll).
UsedThe ad has been consumed.

On iOS, a full-screen ad dismisses as Skipped when the user closes it without a reward, and as Closed otherwise. Handle both when reloading.


Set the privacy mode in EmpowerAdsConfig before initialization.

ModeBehavior
AutomaticThe SDK runs the UMP consent flow (and ATT on iOS) automatically when required. Recommended for most apps.
NonPersonalizedAll ads are non-personalized; no consent dialog is shown.
ManualYou drive consent yourself via RequestConsent().
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();