Quick Start
This guide walks you through creating an app, installing the SDK, and getting your first attributed install.
Prerequisites
Section titled “Prerequisites”- A Trace account with an API key and hash salt
- An Android or iOS app project
-
Create your app
Use the Trace CLI or API to register your app. You’ll get an API key (e.g.
tr_live_xxxx) and a hash salt (64-character hex string). -
Add the SDK
Add the Trace SDK to your
build.gradle.kts:dependencies {implementation("io.traceclick:sdk:<version>")}Add the Trace SDK via Swift Package Manager:
https://github.com/bmcreations/trace-iosOr add to your
Package.swift:.package(url: "https://github.com/bmcreations/trace-ios", from: "<version>") -
Initialize on app launch
class MyApp : Application() {override fun onCreate() {super.onCreate()TraceAndroid.initialize(application = this,config = TraceConfig(apiKey = "tr_live_xxxxxxxxxxxx",hashSalt = "your_64_char_hex_salt",region = Region.US))}}@mainstruct MyApp: App {init() {TraceClient.shared.initialize(config: TraceConfig(apiKey: "tr_live_xxxxxxxxxxxx",hashSalt: "your_64_char_hex_salt"))}}That’s it. The SDK automatically reports the install to Trace and performs attribution on first launch.
-
Create a short link
Terminal window curl -X POST https://api.traceclick.io/v1/links \-H "X-Api-Key: tr_live_xxxxxxxxxxxx" \-H "Content-Type: application/json" \-d '{"deepLinkPath": "/welcome","campaignId": "launch_campaign","fallbackUrl": "https://yourapp.com"}'Response:
{"shortCode": "abc123","shortUrl": "https://yourapp.traceclick.io/l/abc123"} -
Handle the deep link
TraceAndroid.setDeepLinkListener { deepLink ->// deepLink.path = "/welcome"// deepLink.isDeferred = true (arrived via install attribution)navigateTo(deepLink.path)}TraceClient.shared.setDeepLinkListener { deepLink in// deepLink.path = "/welcome"// deepLink.isDeferred = truenavigateTo(deepLink.path)}
What just happened?
Section titled “What just happened?”- You created a short link with a deep link path of
/welcome - When a user clicks that link, Trace records the click and redirects to the app store
- After the user installs and opens the app, the SDK calls Trace
- Trace matches the install to the click and returns the attribution result
- The deferred deep link (
/welcome) is delivered to your listener
Next steps
Section titled “Next steps”- Android setup — full integration guide including deep link routing
- iOS setup — Universal Links, SwiftUI integration
- Deep links — type-safe routing, auth gates, deferred link handling
- Links API — create and manage short links programmatically