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 AdTraceConfig instance before AdTrace.onCreate(). 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 / partner devicesYes
Normal Play Store or direct-download 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

public void setDefaultTracker(String defaultTracker)
ParameterTypeDescription
defaultTrackerStringThe 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 AdTraceConfig instance before AdTrace.onCreate(). See Configuration for how to create the config.
  3. Build and run your app, then confirm the default tracker in LogCat (see Verify the default tracker).

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

Example

config.setDefaultTracker("{TrackerToken}");

Replace {TrackerToken} with the tracker token from the panel.

Verify the default tracker

  1. Set log level to VERBOSE or DEBUG 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. Filter LogCat with the AdTrace tag.

You should see a line like:

LogCat (example)
Default tracker: 'abc123'

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