Skip to main content

Use Cursor, Claude Code, or another AI to help you integrate the Android (Kotlin) SDK.

CursorOpen in Cursor

Appstack ID and attribution params

After configure, you can read the Appstack user ID and the attribution map for partner integrations (for example Superwall, RevenueCat).
val appstackId = AppStackAttributionSdk.getAppstackId()
val attributionParams = AppStackAttributionSdk.getAttributionParams()
  • getAppstackId() — Appstack user identifier when a partner expects $appstackId or similar.
  • getAttributionParams() — Attribution payload (campaign, media source, click IDs, device identifiers where available) to forward to partners.

Maven Central repositoty

Here, you will find the Maven Central Android SDK documentation. Please, use the latest version of the SDK available.

Requirements

  1. Minimum SDK: Android 5.0 (API level 21)
  2. Target SDK: 34+
  3. Java Version: 8+
  4. Gradle: 7.0+

Initial setup

1

Installation

Add the SDK dependency to your app’s build.gradle.kts:
dependencies {
    implementation("tech.appstack.android-sdk:appstack-android-sdk:1.2.2")
}
No additional configuration needed - the SDK will work automatically after installation.
2

Initialize in the application

Follow these steps to get the API key:
  1. In Appstack, from the side menu, select SDK and ensure you are selecting the correct application.
  2. Select the environment. It could be Production or Development.
  3. Copy the assigned API key.
Examples:Configure the SDK in your Application class:
import com.appstack.attribution.AppStackAttributionSdk
import com.appstack.attribution.EventType

class MyApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        
        AppStackAttributionSdk.configure(
            context = this,
            apiKey = "your-android-api-key"
        )
    }
}
3

Configuration parameters

Initialize the SDK with your API key. Must be called in Application.onCreate() before any other SDK methods.Parameters:
  • context - Application context
  • apiKey - Your Android API key from the Appstack dashboard
  • isDebug - Optional debug mode flag (default: false)
  • logLevel - Optional log level configuration
  • endpointBaseUrl - Optional custom endpoint
Example:
AppStackAttributionSdk.configure(
    context = this,
    apiKey = "your-api-key",
    isDebug = BuildConfig.DEBUG,
    logLevel = LogLevel.INFO
)
Debug modeShows debug overlay with SDK status and event information. Only works when isDebug = true.Example:
if (BuildConfig.DEBUG) {
    AppStackAttributionSdk.showDebugOverlay(this)
}
4

Sending events

Track user actions and revenue in your activities:
// Track events without parameters
AppStackAttributionSdk.sendEvent(EventType.SIGN_UP)
AppStackAttributionSdk.sendEvent(EventType.LOGIN)

// Track events with parameters (including revenue)
AppStackAttributionSdk.sendEvent(
    EventType.PURCHASE, 
    parameters = mapOf("revenue" to 29.99, "currency" to "USD")
)

// Custom events
AppStackAttributionSdk.sendEvent(
    EventType.CUSTOM,
    name = "user_attributes",
    parameters = mapOf(
		"email" to "test@example.com",
		"name" to "first_name last_name", 
		"phone_number" to "+33060000000", 
		"date_of_birth" to "2026-02-01" 
	)
)
Available EventType valuesIt is recommended to use standard events for a smoother experience.
  • EventType.INSTALL - App installation (tracked automatically)
  • EventType.LOGIN - User login
  • EventType.SIGN_UP / EventType.REGISTER - User registration
  • EventType.PURCHASE - Purchase transactions
  • EventType.SUBSCRIBE - Subscription events
  • EventType.ADD_TO_CART, EventType.ADD_TO_WISHLIST, EventType.INITIATE_CHECKOUT - E-commerce events
  • EventType.START_TRIAL - Trial start
  • EventType.LEVEL_START, EventType.LEVEL_COMPLETE - Game progression
  • EventType.TUTORIAL_COMPLETE, EventType.SEARCH, EventType.VIEW_ITEM, EventType.VIEW_CONTENT, EventType.SHARE - Engagement events
  • EventType.CUSTOM - For any other custom events
Tracks custom events with optional parameters:
  • event - Event type from EventType enum (required)
  • name - Event name for custom events (optional, required when event is CUSTOM)
  • parameters - Optional map of parameters (e.g., mapOf("revenue" to 29.99, "currency" to "USD"))
Enhanced app campaigns
When running enhanced app campaigns (EACs), it is highly recommended to send multiple parameters with the in-app event to improve matching quality.
For any event that represents revenue, we recommend sending:
  1. revenue or price (number)
  2. currency (string, e.g. EUR, USD)
AppStackAttributionSdk.sendEvent(
    EventType.PURCHASE,
    parameters = mapOf("revenue" to 4.99, "currency" to "EUR")
)
To improve matching quality on Meta, send events including the following parameters if you can fulfill them:
  1. email
  2. name (first + last name in the same field)
  3. phone_number
  4. date_of_birth (recommended format: YYYY-MM-DD)

Superwall

To start using the Superwall integration, click here to see the correct SDK documentation.

Limitations

Platform constraints

  • Android 5.0+ required (API level 21)
  • Attribution only works for Play Store installations
  • Network connectivity required for event transmission (with offline queueing)

Event tracking

  • The SDK must be initialized in Application.onCreate() before tracking calls
  • Custom event names should be descriptive and consistent
  • The debug overlay is only available when isDebug = true

Superwall

To start using the Superwall integration, click here to see the correct SDK documentation.

Support

For questions or issues:
  1. Check the GitHub Repository
  2. Contact our support team at support@appstack.tech
  3. Open an issue in the repository

Use Cursor, Claude Code, or another AI to Validate your existing implementation of the Appstack Android SDK (Kotlin) integration.

CursorOpen in Cursor