---
title: "Partner Tracking Integrations"
description: "Connect AdsGram with AppsFlyer, Adjust, AppMetrica, Kochava, or Keitaro to track installs and conversions for tCPA optimization."
outline: [2,4]
---
# Partner integrations
AdsGram supports integration with popular attribution and tracking platforms. They allow you to track clicks, installs, and user actions after interacting with AdsGram ads, as well as send conversion data back to AdsGram, enabling you to optimize campaigns for conversion cost (tCPA).

The following integrations are available:
- [AppsFlyer](#appsflyer)
- [Adjust](#adjust)
- [AppMetrica](#appmetrica)
- [Kochava](#kochava)
- [Keitaro](#keitaro)

You can also use links from other tracking platforms. However, in this case, AdsGram will not be able to pass all the necessary information to the tracker for more detailed analytics.

## Types of macros that AdsGram reveals:
For detailed tracking, use macros. AdsGram will automatically replace them with real data in your tracking link.
- `{campaign_id}`
- `{banner_id}`
- `{publisher_id}`
- `{useragent}`
- `{device_model}`
- `{click_id}`
- `{ip}`
- `{campaign}` — campaign name
- `{os_version}`
- `{lang}`
- `{gaid}`
- `{idfa}`
- `{record_data}`

::: warning
The required `{record_data}` macro must be included in the campaign URL for the [Keitaro](#keitaro) and [Kochava](#kochava) integrations to work correctly. If the required macro is missing, conversion tracking will not work.
:::

> [!IMPORTANT]
> The macro `{publisher_id}` is revealed only as a unique publisher identifier — without specifying its name or other identifying information.

The dashboard highlights the macros added to the link <img src="../images/icons/added_macros.png" alt="Added macros" width="18" style="display: inline" />  and the ones that are missing <img src="../images/icons/missed_macros.png" alt="Missed macros" width="18" style="display: inline" />.

![Selected macroses](./images/selected_macroses.webp =500x)

## Adjust
### 1. Choose Network
In the **Campaign Lab** section, go to **Partners**
- Click **New Partner**.
- In the search bar, type **AdsGram** and select this network.
- After selecting, click **Next**.

### 2. Choose the App
On the next screen, choose the app for which you want to create the link. Use the search bar to find your app, or scroll through the list to find it. You can set up links for one app at a time.\
After selecting the app, click **Next**.

### 3. Set Data Sharing Options
In this section, you will set up the data sharing parameters with AdsGram, selecting which events and app parameters will be sent to AdsGram for analysis.\
[Detailed instructions are available on the Adjust documentation page](https://help.adjust.com/en/article/data-sharing-ad-network).

### 4. Get Tracking Link
After configuring all parameters and mappings, you will receive a unique tracking link, which should be used when creating advertising campaigns in AdsGram.\
Additionally, you can add extra parameters like UTM tags for more precise tracking of traffic sources.

### 5. Conversion Data Transfer
By default, user activity data is transferred from Adjust to AdsGram and automatically assigned to the corresponding goals:
- Sessions - to Goal 1
- Installs - to Goal 2

> [!IMPORTANT]
> To launch a tCPA campaign, you need to receive at least **10 conversions for the selected goal**. For example, if the campaign is launched with **Goal 2**, you need to receive at least 10 conversions for **Goal 2**.

## AppMetrica
### Creating a tracker:
1. After registering in the AppMetrica personal account, integrating the SDK into the app, and setting up target action tracking, you can proceed to create the tracker.
1. Specify the name of the tracker.
1. Add the application.

[Detailed instructions are available on the AppMetrica documentation page](https://appmetrica.yandex.ru/docs/en/mobile-tracking/add-tracker).

### Installation data transfer:
4. Choose the postback recipient (AdsGram).
4. Specify the event type that needs to be sent to AdsGram.
4. Obtain the Postback URL — the link through which events and installations will be sent to the AdsGram server.
4. After creating the postbacks, you will receive a tracking link. This link should be used when creating campaigns in AdsGram. Additionally, you may add extra parameters, such as UTM tags, if needed.

## Keitaro
### 1. Creating a Tracker in Keitaro
  1. After logging in to the Keitaro dashboard, go to the Trackers section.
  1. Click Create tracker or New tracker.
  1. Enter the tracker name and select AdsGram as the traffic source type.
  1. Click Save to create the tracker.

### 2. Configuring Postback in Keitaro
  1. In the settings of the created tracker, go to the Postback or API Integration section.
  1. In the Postback URL field, enter the AdsGram endpoint:
     ```
     https://api.adsgram.ai/confirm_conversion?
     ```
  1. Add the required `token` parameter and the `record` parameter. The parameter name must match the **record** parameter specified in the Tracking Link.

     For example, if you pass the AdsGram macro in the Tracking Link as follows:
     ```
     https://your-keitaro-domain.com/click.php?campaign_id={campaign_id}&subid={click_id}&record={record_data}
     ```

     then the following should be specified in the Keitaro postback:
     ```
     https://api.adsgram.ai/confirm_conversion?token=YOUR_UNIQUE_TOKEN&record={_record}
     ```

     Where:
     - `YOUR_UNIQUE_TOKEN` — the token from your AdsGram profile
     - `record` — the parameter passed in the Tracking Link
     - `{_record}` — a macro that passes the **original value of the record parameter** to the postback

     ::: warning
     To get a raw value from the tracking system, add “_” (underscore) before the macro name. It is only relevant for the Keitaro tracker and is necessary to prevent XSS attack. 
     :::

### 3. Setting Up a Campaign in AdsGram
  1. Copy the Click URL from your Keitaro tracker settings (for example: https://your-keitaro-domain.com/click.php?campaign_id={campaign_id}&subid={click_id}).
  1. In the AdsGram dashboard, when creating a campaign, paste this link into the Click URL field.
  1. Add the required AdsGram macros to the link:
     ```
     https://your-keitaro-domain.com/click.php?campaign_id={campaign_id}&subid={click_id}&publisher={publisher_id}&banner={banner_id}&record={record_data}
     ```
  1. Make sure the {record_data} macro is included in the final link.

### 4. Setting Up Goals in Keitaro
  1. In your Keitaro tracker settings, go to the Goals or Conversions section.
  1. Create a new goal or select an existing one.
  1. Enable postback sending to the previously specified URL for this goal.
  1. Define the trigger conditions (e.g., upon conversion confirmation or specific status).

## Kochava
### 1. Creating a Tracker in Kochava
  1. After logging into the Kochava dashboard, go to the Apps & Assets section.
  1. Click Add New and select App to create a new application tracker.
  1. Fill in the required fields:
     - Platform: Choose the application platform (iOS, Android, Web).
     - App Name: Enter your app’s name.
     - Store ID: Enter the app’s store identifier (App Store ID, Package Name, etc.).
  1. Click Save to create the application.

### 2. Setting Up Partner Integration
  1. In the created app’s page, navigate to the Partner Management section.
  1. Click Add Partner.
  1. Find and select AdsGram from the list of partners.
  1. Click Next to proceed to the configuration settings.

### 3. Configuring Integration Parameters
  1. In the Integration Settings section, select the tracking type (Click-Through, View-Through, or Hybrid).
  1. Enable the Server-to-Server Postbacks option.
  1. In the Postback URL field, enter the AdsGram endpoint:

     ```
     https://api.adsgram.ai/confirm_conversion
     ```
  4. Add the following parameters to Postback Parameters:
     - Required parameter: `{record_data}` (automatically inserted by Kochava).
     - Add parameter: token with the value `YOUR_UNIQUE_TOKEN` (taken from your AdsGram profile).
  5. Set up data mapping macros:
     - `{campaign_id}` → campaign_id
     - `{click_id}` → click_id
     - `{publisher_id}` → publisher_id

### 4. Setting Up a Campaign in AdsGram
  1. Return to the Tracking Links section in Kochava and create a tracking link (for example: https://your-app.kochava.com/install?data={encrypted_data}).
  1. In the AdsGram dashboard, when creating a campaign, paste this link into the Click URL field.
  1. Add mandatory AdsGram macros to the link as parameters:
     ```
     https://your-app.kochava.com/install?data={encrypted_data}&campaign_id={campaign_id}&click_id={click_id}&publisher_id={publisher_id}&record={record_data}
     ```
  1. Make sure the `{record_data}` macro is included in the final URL.

### 5. Configuring Events in Kochava
  1. In the Kochava dashboard, go to the Events section.
  1. Create a new event or choose a standard one (for example, install, purchase).
  1. Configure the postback for the selected event:
     - Enable Send Postback.
     - Select the previously created AdsGram integration.
     - Define filters and trigger conditions.
  1. Save the event configuration.


### 6. Testing the Integration
  1. Use Test Mode in Kochava to verify install tracking.
  1. Check incoming requests in the Kochava and AdsGram logs.
  1. Ensure that the record_data parameter is being passed correctly.

## AppsFlyer
AdsGram integration with AppsFlyer allows you to send data about app installs and user actions within the app to AdsGram.

After the integration is configured, AdsGram will receive:
- **App installs** - automatically assigned to **Goal 1**
- **In-App Events** - can be sent to **Goal 2** or **Goal 3**, depending on the configured event mapping

You can choose which AdsGram goal specific events are sent to, such as registration, purchase, deposit, and others.

### 1. Connecting AdsGram via Integrated Partners
AdsGram is an integrated partner of AppsFlyer. To connect:
- Go to **Collaboration** → **Partner Marketplace** in AppsFlyer
- Search for **AdsGram** (marketing name) or **adsgram1e_int** (technical name) and select the partner

### 2. Configure Install Postbacks
Open the **Integration** tab:
- Enable **Activate Partner**
- Disable **AAP** (this must be disabled in two places: in the app settings and on this tab)
- For **Install Postback**, select **This partner only**. This means AdsGram will receive installs attributed to AdsGram. These installs will be counted as **Goal 1** in AdsGram.

> [!IMPORTANT]
> If you want to launch a campaign optimized for installs, make sure that installs are being sent to AdsGram and are displayed under **Goal 1**. tCPA campaigns optimized for installs can only be launched with **Goal 1**.

### 3. Configure In-App Event Postbacks
Configure postbacks for In-App Events (purchases, registrations, etc.) in the **In-App Event Postbacks** section.
- Add the required events, for example:
  - purchase - purchases
  - af_complete_registration - registrations
- In the **For users from** field, select **This partner only**
- AdsGram only receives the event itself, without its parameters or revenue. Therefore, under **Including**, you can select **No values & no revenue**
- To send events to specific AdsGram goals, use the **Mapped to parameter event** field:
  - Enter `goal2` to send the corresponding event to **Goal 2**.
  - Enter `goal3` to send the corresponding event to **Goal 3**.

Recommended:
- Allow integration configuration (except in-app event postbacks)
- Allow in-app event postback configuration

Other permissions (retention reports, revenue, etc.) - optional.

After configuring the integration, click **Save Integration**.

### 4. Configure the Tracking Link
Open the **Tracking Link** tab:
- AppsFlyer will automatically generate a tracking link for AdsGram and add the required partner identifier: pid=adsgram1e_int
- The 4 AdsGram macros will be filled automatically (af_storeid, c, etc.)
- If necessary, add static parameters as additional parameters
- In **Click-through attribution**, select the attribution window. The default is 7 days, but you can change it if necessary

### 5. Configure Permissions
Open the **Permissions** tab and enable the required permissions:
- Access to app dashboard
- Aggregated conversions
- Events
- Protect360

👉 Click **Save Integration**

### 6. Campaign Setup in AdsGram
When creating a campaign in AdsGram:
- Paste your AppsFlyer link into the **Link** field. Both AF Links and OneLink URLs are supported.
- The system will automatically generate an AppsFlyer tracking link and add the required macros.
- Specify in the AppsFlyer tracking link your **package/bundle** name if it is not already included (e.g., id12345678 or com.app.name)
- In the **Link** field that appears, enter the direct link to your product on Google Play / App Store / RuStore

#### Using the InCost API
If you want to use the InCost API, add the `af_app_id` parameter to the link and set its value to your app ID.

Example: `af_app_id=YOUR_APP_ID`.

### 7. Notes
- The configuration applies to all banners within the campaign
- The advertiser is responsible for correct link parameters and attribution
- When using a custom link, you must also specify a direct product link in the **Link** field
