---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://appmetrica.yandex.by/docs/en/mobile-tracking/add-preinstall.md
  - https://appmetrica.yandex.by/docs/ru/mobile-tracking/add-preinstall.md
---
> **Documentation Index:** Fetch the complete configuration index at https://appmetrica.yandex.by/docs/en/llms.txt

# Creating a tracker for pre-installs

Pre-installs are apps installed on a device without direct user involvement. AppMetrica offers two methods for tracking these installs:

- OEM pre-installing: The tracking URL is embedded in the APK that the manufacturer installs on the device before selling it. For more information, see [Apps pre-installed by the device manufacturer or retailer](https://appmetrica.yandex.by/docs/en/mobile-tracking/preinstalled-app-attr.md#apk).

- PAI (Play Auto Install): AppMetrica generates a unique tag that the manufacturer inserts into the app store URL (only for Android). For more information, see [Pre-installing apps with PAI (Google Play Auto Install)](https://appmetrica.yandex.by/docs/en/mobile-tracking/preinstalled-app-attr.md#pai).

{% note alert "" %}

Trackers created for pre-installed apps are only available as part of pre-install campaigns. They can't be used in regular campaigns or re-used in other OEM/PAI pre-installs.

{% endnote %}

## Step 1. Choosing a technology {#technology}

Determine which scenario applies to your campaign:

- OEM: The app is pre-installed as part of the device's firmware or build.
- PAI: The app is pre-installed via Play Auto Install.

## Step 2. Creating a tracker {#tracker}

1. In the AppMetrica interface, go to **Tracking** → **Add tracker**.

2. Enter the name of the tracker.

3. Select a [media source](https://appmetrica.yandex.by/docs/en/mobile-tracking/add-partner.md) to attribute clicks, installs, and conversions to.

    If the media source isn't in the list, [add a new source](https://appmetrica.yandex.by/docs/en/mobile-tracking/add-partner.md#add-partner).

    {% note info "" %}

    Once the tracker has been created, you can't change the media source in the settings.

    {% endnote %}

4. Specify **Pre-installing** as the tracker type.

5. Enable or disable the **PAI** (Play Auto Install) option based on your chosen technology.

## Step 3. (*Optional*) Setting up postbacks {#postback}

Trackers for pre-installs support postbacks that automatically send data about successful conversions to media sources. You can add up to five postbacks to one tracker. Use media source templates or configure custom URLs with macros.

## Step 4. Obtaining UTM tag and tracking ID {#result}

- If you have the **PAI** option enabled, click **Generate** to obtain a unique `utm_campaign` tag.
- If you're using OEM pre-installing and have the **PAI** option disabled, a `tracking_ID` appears on the right.

## Step 5. What's next? {#next}

If you're using PAI, send the UTM tag to your media source or manufacturer so they can use it on Google Play.

If you're using OEM pre-installing, configure the AppMetrica SDK:

{% list tabs %}

- Android

    Tracking pre-installed apps is available when using the [extended configuration of the AppMetrica library](https://appmetrica.yandex.by/docs/en/sdk/android/analytics/android-operations.md). To set parameters for tracking pre-installed apps, follow these steps:

    1. Create an object with the necessary tracking parameters:

        ```java translate=no
        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.

        ```java translate=no
        public class MyApp extends Application {
            @Override
            public void onCreate() {
                super.onCreate();
                // Creating an extended library configuration.
                AppMetricaConfig.Builder configBuilder = AppMetricaConfig.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.
                AppMetricaConfig extendedConfig = configBuilder.build();
                // Initializing the AppMetrica SDK.
                AppMetrica.activate(getApplicationContext(), extendedConfig);
            }
        }
        ```

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

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

        ```java translate=no
        ...
        AppMetrica.enableActivityAutoTracking(this);
        ```

- iOS

    Tracking pre-installed apps is available when using the [extended configuration of the AppMetrica library](https://appmetrica.yandex.by/docs/en/sdk/ios/analytics/ios-operations.md). To set information for tracking pre-installed apps, follow these steps:

    {% list tabs %}

    - Objective-C

        1. Create an object with the necessary tracking parameters:

            ```objectivec translate=no
            AMAAppMetricaPreloadInfo *preloadInfo = [[AMAAppMetricaPreloadInfo alloc] initWithTrackingIdentifier:@"tracking_ID"];
            ```

        2. Create the extended configuration of the AppMetrica library and set information in it for tracking pre-installed apps. Then perform library initialization in the app, using the extended configuration.

            ```objectivec translate=no
            // Creating an extended library configuration.
            AMAAppMetricaConfiguration *configuration = [[AMAAppMetricaConfiguration alloc] initWithApiKey:@"API_key"];
            // Setting up the configuration.
            configuration.preloadInfo = preloadInfo;
            // ...
            // Initializing the AppMetrica SDK.
            [AMAAppMetrica activateWithConfiguration:configuration];
            ```

    - Swift

        1. Create an object with the necessary tracking parameters:

            ```swift translate=no
            let preloadInfo = AppMetricaPreloadInfo.init(trackingIdentifier: "tracking_ID")
            ```

        2. Create the extended configuration of the AppMetrica library and set information in it for tracking pre-installed apps. Then perform library initialization in the app, using the extended configuration.

            ```swift translate=no
            // Creating an extended library configuration.
            let configuration = AppMetricaConfiguration.init(apiKey: "API key")
            // Setting up the configuration
            configuration?.preloadInfo = preloadInfo
            // ...
            // Initializing the AppMetrica SDK.
            AppMetrica.activate(with: configuration!)
            ```

    {% endlist %}

{% endlist %}

| Parameter | Description |
| -------- | -------- |
| `API_key` | A unique app ID issued in the AppMetrica web interface at [app registration](https://appmetrica.yandex.com/application/new). |
| `tracking_ID` | A numeric tracker ID that is shown in the AppMetrica interface when creating a tracker. |

<!-- source: en/_includes/feedback-button.md -->
If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.

<a href="../troubleshooting/feedback-new">
  <span class="button">Contact support</span>
</a>

<a href="../troubleshooting/feedback-docs">
  <span class="button">Suggest an improvement for documentation</span>
</a>
<!-- endsource: en/_includes/feedback-button.md -->
