Skip to Content

API Reference

AttributeHQ Object

Singleton accessed directly as AttributeHQ.

initialize(context: Context, configuration: AttributeHQConfiguration)

Initialize the SDK. Must be called before any other method.

val config = AttributeHQConfiguration( apiKey = "ak_your_api_key", appId = "your-app-uuid", enableDebugLogging = true ) AttributeHQ.initialize(applicationContext, config)
ParameterTypeDescription
contextContextApplication context
configurationAttributeHQConfigurationSDK configuration

track(eventName: String, properties: Map<String, Any?> = emptyMap())

Track a custom event.

AttributeHQ.track("purchase", mapOf("amount" to 1500, "currency" to "NGN"))

trackRevenue(amount: Double, currency: String = "NGN", properties: Map<String, Any?> = emptyMap())

Track a revenue event.

AttributeHQ.trackRevenue(5000.0, "NGN", mapOf("product" to "premium"))

identify(userId: String, properties: Map<String, Any?> = emptyMap())

Associate events with a known user.

AttributeHQ.identify("user_12345", mapOf("email" to "user@example.com"))

flush()

Immediately send all queued events.

AttributeHQ.flush()

getAttribution(): AttributionResult?

Get cached attribution result. Returns null if install tracking hasn’t completed.

val result = AttributeHQ.getAttribution()

Types

AttributeHQConfiguration

data class AttributeHQConfiguration( val apiKey: String, val appId: String, val enableDebugLogging: Boolean = false, val batchSize: Int = 10, val flushInterval: Long = 5, // seconds val maxQueueSize: Int = 100 )

AttributionResult

data class AttributionResult( val matchType: MatchType, val confidence: Int, // 0-100 val mediaSource: String?, val campaignId: String?, val isOrganic: Boolean, val attributedTouchTime: Long? // Unix milliseconds )

MatchType

enum class MatchType(val value: String) { INSTALL_REFERRER("install_referrer"), DEVICE_ID("device_id"), FINGERPRINT("fingerprint"), ORGANIC("organic") }

Note: INSTALL_REFERRER is Android-specific — it’s not available on iOS or Web.