An app is its own site in Trace, with its own key. One app site covers Android and iOS: both use the same key, and Trace reports the two platforms apart inside it. If you also have a website, it is a second site, and the app is linked to it.
Set the app up in Trace
- In onboarding, or with Add site, choose An app. If you have a website as well, choose Both: Trace sets up the website first, then the app.
- Enter the app’s name, the platforms it runs on, and what it is built with.
- If the app is on the App Store, paste its App Store link or the number in it. You can leave it empty and add it in settings later.
- Choose the website the app belongs to, if it has one, and the country and currency. The country decides the consent rules the app follows. The currency is what conversion values are in.
- Add the address of the privacy notice your app links to, if you have it.
The next page has the instructions, with your key already in them. Copy all puts the whole set on your clipboard, and Send to your developer emails it to one person. The same instructions are in the app’s site settings afterwards.
Android
Add the SDK to your app’s build.gradle.kts. When the install page shows a version, it is one line. When it says Not released yet, build the library from the Android SDK and add it as a local file, with the install referrer library beside it, as the page shows.
Your app needs the INTERNET permission in AndroidManifest.xml. The SDK declares no permissions of its own.
Start Trace in your Application class, then pass your app’s consent answer on every launch:
override fun onCreate() {
super.onCreate()
Trace.initialise(this, TraceConfig(apiKey = "your key from the install page"))
Trace.setConsent(analytics = consent.analytics, marketing = consent.marketing)
}
iOS
In Xcode, choose File, Add Package Dependencies, and enter https://github.com/use-trace/trace-sdk-ios. When the install page shows a version, choose Up to Next Major Version from it. When it says Not released yet, choose Branch: main.
Start Trace in your App initialiser, or in application(_:didFinishLaunchingWithOptions:), then pass your app’s consent answer on every launch:
import TraceSDK
init() {
Trace.initialise(TraceConfig(apiKey: "your key from the install page"))
if let answer = ConsentStore.saved {
Trace.setConsent(analytics: answer.analytics, marketing: answer.marketing)
}
}
The Trace SDK does not read the advertising identifier and never shows Apple’s tracking prompt. Whether your app needs the prompt depends on what else it does.
Consent comes first
Nothing is sent to Trace until your app calls setConsent. If people refuse analytics, Trace receives their answer and nothing else. Call it on every launch with the answer your app stored, not only the first time.
On iOS the SDK also registers each install with Apple’s attribution, so that Apple can report the campaign behind it. It follows the country you chose for the app: where UK and EU rules apply it waits for a yes before it registers or stores anything, and elsewhere it registers on the first launch unless the person says no. A no always stops it. Use version 0.3.0 or later of the iOS SDK.
Conversions and the install id
Record a conversion with Trace.conversion("purchase", value = 29.99) on Android, or Trace.conversion("purchase", value: 29.99, metadata: [:]) on iOS. The value is in the currency set for the app in Trace.
Trace.installId is the id Trace knows this install by. Your privacy notice tells people they can find it in your app’s privacy settings, so show it there.
React Native and Flutter
Both have an Android project and an iOS project inside them, and that is where the SDKs go: the install page labels the blocks “In your app’s Android project” and “In your app’s iOS project”. To record conversions from JavaScript or Dart, your developer writes a small bridge that calls Trace.conversion.
If your app is built some other way, for example with an app builder, Trace has no SDK for it yet.
See it arrive
The install page checks by itself and turns green on the first install from each platform, with the time it arrived. Your own test install counts as an install, as your own visit to a website does.
- Waiting: build and run the app with Trace added, and allow analytics when your app asks for consent.
- Trace has heard from your app but has not been allowed to record: the app sent a consent answer that did not allow analytics. Check that your test build calls
setConsentwith analytics allowed. - Still waiting after 10 minutes: check that the app calls
setConsent, that the key is this app’s and not another site’s, and on Android that the app has theINTERNETpermission. Turning ondebugLogginginTraceConfigshows what the SDK is doing in your log.
You can skip this step and come back to it. Adding Trace to your app stays on your set up checklist until the first install arrives.
