Skip to main content

Default tracker

Use a default tracker when your app is pre-installed on a device. The first time a user opens that pre-installed app, Adtrace attributes the install to the tracker you set.

This is a read-only setting: call setDefaultTracker: on your ADTConfig instance before [Adtrace appDidLaunch:] / Adtrace.appDidLaunch(...). You cannot change it after the SDK starts.

When to use a default tracker

Use caseSet a default tracker?
App shipped pre-installed on OEM or partner devicesYes
Normal App Store or TestFlight installs with campaign linksNo, use your tracker URLs as usual
Override organic attribution for unattributed usersNo, default tracker is for pre-install flows only

Method signature

- (void)setDefaultTracker:(NSString *)defaultTracker;

You can also assign the defaultTracker property directly on ADTConfig:

@property (nonatomic, copy, nullable) NSString *defaultTracker;
ParameterTypeDescription
defaultTrackerNSStringThe Adtrace tracker token for pre-installed installs. Pass only the token (for example abc123), not the full tracker URL. The value is case-sensitive.

Set a default tracker

  1. Create a new tracker in the Adtrace panel. Use this tracker to measure pre-installed installs.
  2. Call setDefaultTracker: on your ADTConfig instance before appDidLaunch. See Configuration for how to create the config.
  3. Build and run your app, then confirm the default tracker in the Xcode console (see Verify the default tracker).

The panel shows a full tracker URL (for example https://app.adtrace.io/abc123). In your code, pass only the token at the end (abc123), not the entire URL.

Example

AppDelegate.m
NSString *appToken = @"{YourAppToken}";
NSString *environment = ADTEnvironmentSandbox;
ADTConfig *adtraceConfig = [ADTConfig configWithAppToken:appToken
environment:environment];
[adtraceConfig setDefaultTracker:@"{TrackerToken}"];

[Adtrace appDidLaunch:adtraceConfig];

Or assign the property:

adtraceConfig.defaultTracker = @"{TrackerToken}";

Replace {YourAppToken} with your app token and {TrackerToken} with the tracker token from the panel.

Verify the default tracker

  1. Set log level to ADTLogLevelVerbose or ADTLogLevelDebug while testing.
  2. Build and run your app on a device with the pre-installed build (or your test build with the default tracker configured).
  3. Open the Xcode console for your running app.

You should see a line like:

Xcode console (example)
Default tracker: 'abc123'

If this line does not appear, check that you called setDefaultTracker before appDidLaunch and that the token matches the tracker in the panel.