adjust-icon

Adjust Store & Pre-Install Tool

If your app is pre-installed on a device, you need to use a pre-install link to attribute users. The Adjust Store & Pre-Install Tool (adjust-dtt) enables you to insert this information into your APK. The Adjust SDK reads the information inserted by adjust-dtt. This enables you to attribute users of pre-installed apps to specific Adjust links.

Before you begin

To get started, download the adjust-dtt tool from GitHub. You need to make this file executable to use it. Run the following command to make the file executable:

Terminal window
$ chmod +x adjust-dtt

Before you can use adjust-dtt, you need to set up your machine. adjust-dtt requires the following tools to be installed on your device:

  • ruby: the language tools used to run adjust-dtt.
  • apktool: a tool for unpacking and re-packing APKs.
  • jarsigner: a tool for signing APKs.

Follow these instructions to install each one.

Ruby

Apktool

Jarsigner

Step 1. Get keystore file

When you create an APK, Android Studio will sign it. This happens even if you have generated an “unsigned” version of the APK. When you do this, Android Studio signs the APK with a default debug signing keystore file. This keystore file is located at ~/.android/debug.keystore by default.

If you export a signed APK from Android Studio, you will sign the APK with your custom signing keystore file.

To use adjust-dtt you need to have access to either the default keystore file or your custom one. This is because apktool removes all signing when you use it to unpack the APK. Once you repackage the APK, signing isn’t re-enabled. You need to run jarsigner with your signing information to re-sign the APK to deliver it to Android devices.

Next, you need to create a link in your Adjust dashboard. You will use the link token as the default campaign for your pre-installed app. This means that all users who have the app pre-installed will be attributed to this token.

Step 3. Create a config file

Once you have your keystore file and your link token, you can create a configuration file. adjust-dtt uses an adjust-config.yaml configuration file to read your settings. This file includes settings for the different app stores you need to set up.

Here’s an example adjust-config.yaml file including settings for three stores named store_1, store_2, and store_3.

adjust-config.yaml
apk_path: /Users/username/Desktop/apk/example-release.apk
keystore_path: /Users/username/Desktop/apk/mykeystore.jks
keystore_pass: mykeystorepass
keystore_alias: mykeystorealias
stores:
store_1:
default_tracker: abc123
store_2:
default_tracker: abc456
store_3:
default_tracker: abc789

You can define global parameters in the root of the file if you want to use the same settings for each store. Parameters set on a store will override the global parameters for that store. For example:

adjust-config.yaml
apk_path: /Users/username/Desktop/apk/example-release.apk
keystore_path: /Users/username/Desktop/apk/mykeystore.jks
keystore_pass: mykeystorepass
keystore_alias: mykeystorealias
stores:
store_1:
default_tracker: abc123
keystore_path: /Users/username/Desktop/apk/differentkeystore.jks
keystore_pass: differentkeystorepass
keystore_alias: differentkeystorealias
store_2:
default_tracker: abc456
store_3:
default_tracker: abc789

In this example, the adjust-dtt tool uses differentkeystore.jks, differentkeystorepass and differentkeystorealias when generating the APK for store_1. The tool generates a modified APK for each store.

Step 4. Run the adjust-dtt tool

The adjust-dtt tool takes the path to the your adjust-config.yaml file as an argument. To add your campaign information to your APK, run the tool like this:

Terminal window
$ adjust-dtt adjust-config.yaml

adjust-dtt does the following:

  1. Unpacks your APK into a folder. The folder will be located in the same directory as your APK. It will have the same name as your APK.
  2. Searches for an assets folder and an adjust_config.properties file. The adjust_config.properties file contains default campaign information.
    1. Creates the assets folder and adjust_config.properties file if they don’t exist. The tool writes your default_tracker information to the adjust_config.properties file.
    2. Writes the default_tracker information to the adjust_config.properties file if it exists. If the file already contains a default campaign value, it compares the two. If they differ, the value in your adjust-config.yaml file overwrites the existing value.
  3. Repackages the APK.
  4. Signs the APK with the information specified in the adjust-config.yaml. It uses the keystore_path, keystore_pass, and keystore_alias parameters.
  5. Generates an APK with the same name as the original with a _[store_name] suffix. In the above example, the tool generates three APK files. These would be named example-release_store_1.apk, example-release_store_2.apk and example-release_store_3.apk. Once the tool has generated these files, you can rename them.

If you have any questions or issues with this tool, contact support@adjust.com.