Skip to content

Configuration

The TraceConfig object controls SDK behavior. Pass it during initialization.

TraceConfig(
apiKey = "tr_live_xxxxxxxxxxxx", // Required
hashSalt = "your_64_char_hex_salt", // Required
region = Region.US, // US (default) or EU
debug = false // Enable verbose logging
)

TraceConfig is defined in shared code, so it works identically in Android, iOS, and KMP commonMain.

ParameterDescription
apiKeyYour app’s API key. Starts with tr_live_ (production) or tr_test_ (sandbox).
hashSalt64-character hex string used for privacy-preserving IP hashing. Unique per app.
ParameterDefaultDescription
regionRegion.USData region. Region.US or Region.EU. Must match the region your app was created in.
debugfalseWhen true, the SDK logs fingerprint data, attribution results, and network calls to the console.
enabledtrueWhen false, disables all data collection and network requests at initialization. Use for privacy opt-out.

Trace supports US and EU regions. When you create an app, you choose a region. The SDK must be configured with the same region.

// US region (default)
TraceConfig(apiKey = "...", hashSalt = "...", region = Region.US)
// EU region
TraceConfig(apiKey = "...", hashSalt = "...", region = Region.EU)

Data is pinned to the region — EU app data never touches US servers, and vice versa.

Enable debug logging to see what the SDK is doing:

TraceConfig(
apiKey = "tr_live_xxxxxxxxxxxx",
hashSalt = "...",
debug = true
)

With debug = true, the SDK logs:

  • Device fingerprint (screen size, OS version, locale, timezone)
  • Attribution request/response
  • Deep link delivery
  • Event tracking calls

Check Logcat (Android) or Console (iOS) for output tagged Trace.

For unit tests and UI tests, use test mode to avoid network calls:

TraceConfig.test(
simulatedDeepLink = DeepLink(
path = "/product/test_id",
params = mapOf("color" to "blue"),
isDeferred = true
)
)

In test mode:

  • No network requests are made
  • Attribution immediately returns with the simulated result
  • The simulated deep link (if provided) is delivered to your listener
  • All behavior is synchronous and deterministic
  • No platform context is required (no Android Application needed)

Use Trace.resetForTesting() to clear SDK state between test cases. This ensures each test runs in isolation:

@BeforeTest
fun setUp() {
Trace.resetForTesting()
}

resetForTesting() clears the attribution-done flag, pending deep links, and all registered listeners.

Trace supports a runtime opt-out mechanism for user privacy preferences — for example, after an Apple ATT denial or GDPR consent withdrawal.

If you already know the user has opted out (e.g. from a saved preference), pass enabled = false in the config:

TraceConfig(
apiKey = "tr_live_xxxxxxxxxxxx",
hashSalt = "...",
enabled = false // No data collected until enabled
)

Toggle data collection at any time using setEnabled():

// Disable after user opts out
Trace.setEnabled(false)
// Re-enable if user changes their mind
Trace.setEnabled(true)
// Check current state
val isTracking = Trace.isEnabled

The preference is persisted across app restarts — you don’t need to call setEnabled() every launch.

When disabled:

  • No fingerprint data is collected
  • No network requests are made (attribution, events, opens)
  • Deep link listeners are not fired