Use Cursor, Claude Code, or another AI to help you integrate the Unity SDK.
Repository
Here, you will find the Appstack Unity SDK repository and the OpenUPM package page. Please use the latest available version of the SDK.Quickstart
Use this path when you only need the minimum production integration:- Add
https://package.openupm.comas a scoped registry forcom.appstack, then addcom.appstack.unity-sdkfrom the Unity Package Manager. - Install EDM4U so the Android native dependency resolves automatically, and set the minimum iOS version to 15.0.
- Copy the Production API key from SDK in Appstack, for each platform you ship.
- Open Edit → Project Settings → Appstack, select Create Appstack Settings, and paste the keys — or call
AppstackSDK.Configure(...)once at startup instead. - Send standard events such as
EventType.LOGIN,EventType.SIGN_UP,EventType.PURCHASE, andEventType.SUBSCRIBE. - Confirm events appear in the Appstack SDK page before enabling downstream integrations.
Requirements
iOS
- iOS version: 15.0+
- Target minimum iOS Version in Player → iOS must be
15.0or newer.
Android
- Minimum API level: 21 (Android 5.0).
- Target API level: 34+
- Java: 17+
- Native dependency: EDM4U (recommended) or the manual Gradle setup.
General
- Unity: 6 (
6000.0) or newer.
Initial setup
1
Installation
OpenUPM (recommended)Use the current version from the OpenUPM package page.iOS ConfigurationThe dependency must be available to the
- Add
https://package.openupm.comas a scoped registry forcom.appstack. - In Unity, open Window → Package Manager.
- Select + → Add package by name and enter
com.appstack.unity-sdk.
Packages/manifest.json directly:- Open Edit → Project Settings → Player → iOS.
- Set Target minimum iOS Version to
15.0or newer. - Build the iOS player normally.
unityLibrary module that compiles Android plugins.Minification: no manual R8 or ProGuard configuration is required. Appstack adds its bridge keep rules to the generated Android project automatically, and the native SDK provides its own consumer rules. You do not need to enable Unity’s Custom Proguard File setting for Appstack.2
Initialization
Follow these steps to get the API key:Manual initializationLeave the settings asset absent, or turn off Auto Initialize, when a consent flow, a custom bootstrap order, or remotely supplied configuration must come first. Call The first successful automatic or manual configuration wins. Repeating the same configuration is a silent no-op; a conflicting repeat is ignored with a warning that does not expose either API key. A failed configuration attempt does not lock the wrapper and can be retried.
- In Appstack, from the side menu, select SDK and ensure you are selecting the correct application.
- Select the Production environment.
- Copy the API key.
- Auto Initialize — turn auto-initialization on or off.
- Environment —
Automaticuses the development key for Unity Development Builds and the production key for other builds.DevelopmentandProductionpin every build to that environment. - Allow Production Fallback — lets a development build use its production key when no development key is configured. Off by default. Production builds never fall back to a development key.
- Log Level —
0=DEBUG,1=INFO,2=WARN,3=ERROR. - Enable iOS / Enable Android — enable each platform independently, each with its own Development API Key and Production API Key.
- Enable Apple Ads Attribution — enables Apple Ads attribution as part of iOS auto-initialization.
Creating settings opts the project into auto-initialization. Installing the package alone creates no settings and changes no runtime behavior.
Configure once during application startup and before any other SDK method:3
Configuration parameters
Initializes the SDK with your API key. Call it once during application startup, before any other SDK method.Parameters:You can check whether the SDK ended up disabled (for example after an invalid API key):
apiKeyYour platform-specific API key from the Appstack dashboard.logLevelOptional log level: 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR (default: 1). iOS has no dedicated warning level, soWARNbehaves likeERRORthere.customerUserIdOptional customer user ID.
4
Customer user ID
The customer user ID is your own identifier for the signed-in user. Appstack attaches it to events so server-to-server events — which identify the user by this ID rather than by the install — can be joined back to the install that produced them.Pass it to
Configure when you already know it at startup. More often a login reveals it afterwards, so set it whenever it becomes known:- Callable at any time, before or after
Configure, as often as you like. The last call wins, and it applies to every event sent from then on, including ones the native SDK has buffered but not yet flushed. - The call does not send anything by itself: make sure at least one event follows, or no mapping is ever formed.
- Calling
Configureagain to change the ID does not work — a repeatConfigureis a no-op and itscustomerUserIdis ignored.
5
Sending events
Track user actions and revenue from your scripts:Available EventType valuesIt is recommended to use standard events for a smoother experience.To improve matching quality on Meta, send events including the following parameters if you can fulfill them. Appstack automatically encrypts these matching parameters before using them for attribution matching.
EventType.INSTALL is tracked automatically by the native SDKs on first launch. Do not send it manually — SendEvent(EventType.INSTALL) is a no-op.EventType.LOGIN/EventType.SIGN_UP/EventType.REGISTERAuthenticationEventType.PURCHASE/EventType.ADD_TO_CART/EventType.ADD_TO_WISHLIST/EventType.INITIATE_CHECKOUT/EventType.START_TRIAL/EventType.SUBSCRIBEMonetizationEventType.LEVEL_START/EventType.LEVEL_COMPLETEGame progressionEventType.TUTORIAL_COMPLETE/EventType.SEARCH/EventType.VIEW_ITEM/EventType.VIEW_CONTENT/EventType.SHAREEngagementEventType.CUSTOMFor application-specific events
eventType- Event type from theEventTypeenum (required).eventName- Event name required forCUSTOMevents; ignored for standard events.parameters- Optional dictionary of parameters (e.g.{ "revenue", 29.99 },{ "currency", "USD" }).
NaN or infinity throw an ArgumentException before the event is sent.Enhanced app campaignsFor any event that represents revenue, we recommend sending:revenueorprice(number).currency(string, e.g.EUR,USD).
email.name(first + last name in the same field).phone_number— also accepted asphoneorphoneNumber.date_of_birth(recommended format:YYYY-MM-DD) — also accepted asbirthdate,birthday, ordateOfBirth.gender.
Appstack ID and attribution params
After configuration, you can read the Appstack user ID and the attribution parameters, so you can forward them to any partner SDK that accepts attribution data.GetAppstackId()— Appstack user identifier when a partner expects$appstackIdor similar.GetAttributionParams(onSuccess, onError)— Attribution payload (campaign, media source, click IDs, device identifiers where available) to forward to partners.
GetAttributionParams is called, when one is available. Calling it from Unity’s main thread lets the callbacks safely update Unity objects.
Development setup
Environment-based configuration
With auto-initialization, keep Environment onAutomatic: Unity Development Builds use the development key and other builds use the production key. For manual initialization, resolve the key yourself:
Editor and unsupported platforms
In the Unity Editor and on non-iOS/Android platforms, SDK methods are no-ops or return safe defaults:GetAppstackId() returns null and IsSdkDisabled() returns true. These platforms do not call native code, so verify your integration on a device or in a store build.
Platform-specific considerations
iOS
Apple Ads attribution:- Requires iOS 15.0+ and an App Store or TestFlight installation.
- Attribution data appears within 24-48 hours.
- User consent may be required for detailed attribution.
- Simulator and ordinary development installs do not represent the production attribution flow.
Android
Play Store Attribution- Install referrer data collected automatically.
- Attribution available immediately for Play Store installs.
- Works with Android 5.0+ (API level 21).
Security and privacy
- Never commit API keys to version control. The password fields in Project Settings → Appstack mask keys visually only: values stay plaintext in the settings asset and in version control.
- Unity includes the entire
Resourcesasset in player builds, so every configured key — including development keys and keys for the other mobile platform — may be present in a production player. Treat them as application ingestion credentials, not administrative secrets. - Use separate production and development keys.
- Do not put personally identifiable information in event names.
- Only send matching parameters such as
email,name,phone_number, anddate_of_birthwhen your app has the right consent and compliance basis. Appstack automatically encrypts these fields before using them for attribution matching. - Prefer standard event types for common flows so event mapping remains consistent across Appstack and ad integrations.
Limitations
Attribution timing
- iOS: Apple Ads attribution data appears within 24-48 hours after install.
- Android: Install referrer data available immediately for Play Store installs.
- Attribution only available for apps installed from official stores.
Platform constraints
- Unity: 6 (
6000.0) or newer. - iOS: requires iOS 15.0+.
- Android: minimum API level 21, target API level 34+, Java 17+.
- Android builds require EDM4U or the manual Gradle dependency; the package does not bundle the native Android SDK.
- SDK methods are no-ops in the Editor and on non-iOS/Android platforms.
Event tracking
- Event names are case-sensitive and standardized.
- For revenue events, always pass a
revenue(orprice) and acurrencyparameter. - The SDK must be configured — automatically or manually — before any tracking call.
SendEvent(EventType.INSTALL)is ignored; install is tracked automatically.EnableAppleAdsAttribution()only applies on iOS and is a no-op on Android.- Custom events require an
eventName; unsupported parameter values throw anArgumentExceptionbefore the event is sent. - Network connectivity required for event transmission (events are queued offline).
Troubleshooting
Configuration fails
- Confirm the API key was copied from the correct app and environment in Appstack.
- Confirm
AppstackSDK.Configure(...)runs once at startup before any other SDK method, or that auto-initialization settings exist with a key for the current target and environment. - Check
AppstackSDK.IsSdkDisabled()and the Unity Console withlogLevel: 0(DEBUG). - Remember that a repeat
Configureis ignored, so a second call cannot change the API key, log level, or customer user ID.
Events do not appear
- Confirm the build runs on a device: SDK methods are no-ops in the Editor.
- Confirm configuration completed before the first
SendEvent(...)call. - Confirm the device has network connectivity.
- Check that revenue events include a numeric
revenueorpricevalue and a validcurrency. - Allow a few minutes for events to appear in the dashboard.
iOS build cannot find AppstackSDK
- Delete the generated Xcode project and export it again from Unity.
- Check the Unity Console for postprocessing errors.
- Confirm the generated Xcode project lists the
AppstackSDKpackage product on both theUnityFrameworkand application targets. - Confirm the build machine can reach GitHub to resolve Swift packages.
Gradle cannot resolve the Appstack Android SDK
- Run Assets → External Dependency Manager → Android Resolver → Resolve again.
- Confirm Maven Central is available in the generated Gradle repositories.
- Confirm the build uses Java 17 or newer.
- Inspect the Unity Console and Gradle output for the original resolution error.
A build fails with an Appstack configuration error
- Auto-initialization is enabled for the current target platform but no key resolves for that build. Add the missing key in Edit → Project Settings → Appstack, disable that platform, or turn off Auto Initialize.
- For a development build with only a production key, either add a development key or enable Allow Production Fallback.
Apple Ads
To start using the Apple Ads integration, click here to see the correct SDK documentation.Verification checklist
com.appstack.unity-sdkis installed from OpenUPM at a current version.- Project meets Unity 6+, iOS 15.0+, Android API level 21+ / target 34+, and Java 17+ requirements.
- Target minimum iOS Version is set to 15.0 or newer.
- EDM4U is installed and resolved, or the manual Gradle dependency is configured for the
unityLibrarymodule. - Platform-specific API keys are configured for iOS and Android.
- Production API keys are used in production builds; development keys only in development builds.
- The SDK is configured exactly once — through auto-initialization settings or a single
Configure(...)at startup. - iOS-only Apple Ads calls are guarded with
#if UNITY_IOS && !UNITY_EDITOR, or enabled through the settings asset. EventType.INSTALLis not sent manually.- Login, signup, purchase, subscription, and other key app events use standard event types where possible.
- Revenue events include
revenueorpriceandcurrency. - Custom events use
EventType.CUSTOMwith a descriptiveeventName. - The customer user ID is set once it becomes known, with at least one event following.
- Appstack ID and attribution params are available before wiring partner integrations.
- Events are visible in the Appstack SDK page before launch.
Support
For questions or issues:- Check the GitHub Repository.
- Contact our support team at support@appstack.tech
- Open an issue in the repository.
Use Cursor, Claude Code, or another AI to validate your existing Appstack Unity SDK integration.