Skip to main content

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

1. Initialize in the application

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)

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

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