Tracking pre-installed apps

Pre-installing apps by the device manufacturer or retailer is a popular method of app distribution. AppMetrica allows you to track activation of pre-installed apps by using tracker data. This data is transmitted using a tracking ID.

For example, you've partnered with a vendor who distributes your app by pre-installing it on devices. All activations of the pre-installed app should be attributed to this partner. In order for this to happen, the first time the app is opened, it should send the AppMetrica SDK information that this is a special build of the app for pre-installation, along with information about the partner.

The AppMetrica SDK has special setter methods for storing (“hard coding”) partner information for attribution and sending postbacks. If you have multiple partners who pre-install the app, create a separate app build for each partner. The build should have settings with various information about the partner that this build is for.

Getting a tracking ID

  1. In the AppMetrica interface, go to the “Media Sources” page and add a media source or choose one from the list. Then go to the page for the media source.
  2. Create a tracker by clicking Create tracker and configure it. Pay special attention to the following settings:

    • Destination URL — Enter a fake link (such as https://yandex.com). This field is not used when tracking pre-installed apps.
    • Media Source — Make sure the correct advertising partner is selected in the list.
    Attention. For testing the tracking, enable the reattribution option in the tracker settings. It enables to detect the pre-installed app more than once.
  3. Find the created tracker in the list and go to the tracker page. Use the ID shown on the page as the tracking ID when configuring the AppMetrica SDK.

Attention. To get accurate statistics on pre-installed app activations, do not use the tracking URL from the created tracker. Create a separate tracker for each media source.

Configuring the AppMetrica SDK

Tracking pre-installed apps is available when using the extended configuration of the AppMetrica library. To set parameters for tracking pre-installed apps, follow these steps:

  1. Create an object with the necessary tracking parameters:

    public class MyApp extends Application {      @Override      public void onCreate() {          super.onCreate();           // Creating an instance of a constructor for app pre-installation information.          PreloadInfo.Builder preloadInfoBuilder = PreloadInfo.newBuilder(tracking_ID);           // Creating an instance of information about app pre-installation.          PreloadInfo preloadInfo = preloadInfoBuilder.build();
  2. Create the extended configuration of the AppMetrica library and enter parameters for tracking pre-installed apps. Then perform library initialization in the app, using the extended configuration.

    public class MyApp extends Application {      @Override      public void onCreate() {          super.onCreate();          // Creating an extended library configuration.
              YandexMetricaConfig.Builder configBuilder = YandexMetricaConfig.newConfigBuilder(API_key);          // Setting necessary parameters (for example, enabling logging).          configBuilder.setLogEnabled();          ...
              // Setting tracking parameters for pre-installed apps.          configBuilder.setPreloadInfo(preloadInfo);          // Creating an extended configuration instance.          YandexMetricaConfig extendedConfig = configBuilder.build();          // Initializing the AppMetrica SDK.
              YandexMetrica.activate(getApplicationContext(), extendedConfig);      }}

    Initialize the AppMetrica SDK this way for all the app processes.

  3. Use the method of the YMMYandexMetrica class to enable tracking user activity:

    ...
    YandexMetrica.enableActivityAutoTracking(this);
ParameterDescription
API_keyA unique application identifier that is issued in the AppMetrica web interface during app registration.
tracking_IDA numeric tracker ID that is shown in the AppMetrica interface when creating a tracker.