Download the SDK module.
⬇ Download swedtrack-android.zip
include ':swedtrack-sdk-android'
dependencies {
implementation project(':swedtrack-sdk-android')
}
Drop the Kotlin module into your project, initialize once, request consent, fire events, and configure the bridge URL — that's it.
⬇ Download swedtrack-android.zip
include ':swedtrack-sdk-android'
dependencies {
implementation project(':swedtrack-sdk-android')
}
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="com.google.android.gms.permission.AD_ID" />
import com.adswedmedia.swedtrack.SwedTrack class MyApp : Application() { override fun onCreate() { super.onCreate() SwedTrack.init( context = this, appToken = "swt_YOUR_TOKEN", appSecret = BuildConfig.SWEDTRACK_SECRET, environment = SwedTrack.Environment.PRODUCTION ) } }
BuildConfig or a secrets file outside source control.Without consent the SDK is a no-op — no data is collected, no network requests are made.
SwedTrack.setUserConsent(granted = true)
Event tokens look like evt_29124087 — copy them from the Events tab on your app's detail page. Do not use the human name (purchase, level_5) — the SDK needs the token.
// Simple event — uses the token shown in the Events tab SwedTrack.trackEvent("evt_29124087") // Revenue event — for in-app purchases SwedTrack.trackRevenue("evt_29124087", amount = 4.99, currency = "USD") // Custom data attached to the event (sent as JSON) SwedTrack.trackEvent("evt_60625c0f", mapOf("level" to 5))
This is the step that turns installs into publisher payouts. The SDK by itself only tracks data. The bridge is what tells AdswedMedia to credit the publisher who sent the user.
In your campaign / ManualOffer config in AdswedMedia, paste your SwedTrack tracking link as the destination URL, with the [[userId]] macro appended as the user_id query parameter:
https://pro.adswedmedia.com/t/YOUR_LINK_TOKEN?user_id=[[userId]]
AdswedMedia replaces [[userId]] with each publisher's unique ManualOfferLog.token at click time. SwedTrack captures it on the click row. When the install fires, the bridge uses that token to credit the right publisher with the bid you configured on the ManualOffer.
1 (paid or pending depending on auto-pay). If nothing appears, check the SwedTrack admin panel's Bridge log card for the failure reason.
moflog_not_found for every install — visible in the admin Bridge log card.
If you need to integrate from another platform (iOS, Unity, server-side), implement the HTTP protocol directly. Every request to /sdk/v1/install and /sdk/v1/event must be HMAC-signed with your app_secret.
| Field | Required | Description |
|---|---|---|
app_token | yes | The 16-char swt_* token from your app's SDK tab |
gaid / idfa | install | Lowercase Google Advertising ID or Apple IDFA |
install_id | event | Returned by /install — store and re-send on each event |
event_token | event | The 12-char evt_* token from the Events tab |
nonce | yes | Unique per request, 8–40 chars. Replay-protected for 30 minutes. |
timestamp | yes | Unix seconds. Must be within ±10 minutes of server time. |
signature | yes | HMAC-SHA256 as described below (hex, lowercase). |
How to compute signature:
// 1) Take all payload fields EXCEPT signature/nonce/timestamp // 2) Coerce values: null → "", arrays → json_encode, else → toString // 3) Sort keys alphabetically // 4) Build x-www-form-urlencoded body of those sorted pairs // 5) Append "|{nonce}|{timestamp}" to the body // 6) HMAC-SHA256, key = your app_secret as UTF-8 bytes // 7) Hex-encode (lowercase) — that's the signature canonical = sorted_form_query(payload_minus_sig_nonce_ts) + "|" + nonce + "|" + timestamp signature = hmac_sha256(canonical, app_secret_string).hex().lower()
app_secret is a 64-char hex string. Use the literal hex string as the HMAC key — do not hex-decode it. Both server and SDK sign with the UTF-8 bytes of that string.