🏗️Under construction.🏗️ If you'd like to help feel free to send a PR or join the OpenAttribution Discord.
More info on OpenAttribution.dev.
To have a fully functional SDK which can be used to track and attribute installs, events and revenue for iOS back to an OpenAttribution server.
- Library installable via Maven
- user input server endpoint ie
https://demo.openattribution.dev
- Events:
- app_open tracking and attributing
- Basic event tracking
- Basic revenue tracking
- Documentation for how to use and next steps
You can get the latest version of OpenAttribution's (Android SDK from Maven Central)[https://central.sonatype.com/artifact/dev.openattribution/open-attribution-sdk]
build.gradle.kts
dependencies {
implementation("dev.openattribution:open-attribution-sdk:{LATEST_VERSION}")
// rest of your dependencies
}
MyApplication.kts
import android.app.Application
import dev.openattribution.sdk.OpenAttribution
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
// Initialize the OpenAttribution SDK, replace with your domain
OpenAttribution.initialize(this, "https://demo.openattribution.dev")
}
}
Add to AndroidManfiest.xml
if doesn't exist yet. OpeenAttribution reequires internet permission and add the MyApplication
to your application if you do not yet have an Application class.
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MyApplication"
...
Use trackEvent
to log custom events in your app.
Parameter | Type | Description |
---|---|---|
context |
Context |
Android context (e.g., Activity or Application). |
eventName |
String |
Name of the custom event to track (e.g., "button_click"). |
Example use:
import dev.openattribution.sdk.OpenAttribution
...
OpenAttribution.trackEvent(context, "my_event_name")
Use trackPurchase
to track revenue for In App Purchases in your app.
Parameter | Type | Description | Default |
---|---|---|---|
context |
Context |
Android context (e.g., Activity or Application). | - |
revenueAmount |
Double |
Purchase amount (e.g., 12.34). | - |
currency |
String |
ISO 4217 currency code (e.g., "USD"). | - |
eventName |
String |
Event name for tracking. | "iap_purchase" |
OpenAttribution.trackPurchase(context, 12.34, "USD")
If you're interested in contributing to OpenAttribution Android SDK please don't hesitate to reach out on Discord or with a PR.
The OpenAttribution postback API will expect or allow the values as defined here: https://github.com/OpenAttribution/Open-Attribution/blob/main/apps/postback-api/config/dimensions.py
This is a sample of the minimum required postback by the OpenAttribution server. The empty IFA.
POST https://demo.openattribution.dev/collect/events/com.example.app HTTP/1.1
Content-Type: application/json
{
"ifa": "00000000-0000-0000-0000-000000000000",
"event_time": 1732003510046,
"event_uid": "5730a99e-b009-41da-9d52-1315e26941c1",
"event_id": "app_open",
"oa_uid": "3bd9e091-fa6e-4b91-8dd1-503f8d4fe8f2"
}