---
title: "Adjust"
description: "Adjustをアダプティに接続して、サブスクリプションのトラッキングと分析を改善します。"
---

[Adjust](https://www.adjust.com/) は、マーケティングキャンペーンのデータを収集・提供する主要なMMP（モバイル計測パートナー）プラットフォームの一つです。企業はこれを活用してキャンペーンのパフォーマンスを把握できます。

Adaptyは、ストアからのサブスクリプションイベントを一か所で追跡できる完全なデータセットを提供します。Adaptyを使えば、ユーザーの行動を把握し、好みを理解した上で、ターゲットを絞った効果的なコミュニケーションが可能になります。このインテグレーションにより、Adjustでサブスクリプションイベントを追跡し、キャンペーンが生み出す収益を正確に分析できます。

AdaptiとAdjustのインテグレーションは、主に2つの方法で機能します。

1. **AdaptiがAdjustからアトリビューションデータを受け取る**
   Adjustインテグレーションを設定すると、AdaptiはAdjustからアトリビューションデータを受け取り始めます。このデータはユーザーのプロファイルページで簡単に確認できます。

  
    <img src="/assets/shared/img/98769d9-CleanShot_2023-08-11_at_14.39.182x.webp"
    style={{
      border: '1px solid #727272', /* border width and color */
      width: '700px', /* image width */
      display: 'block', /* for alignment */
      margin: '0 auto' /* center alignment */
    }}
  />
  

2. **AdaptiがサブスクリプションイベントをAdjustに送信する**
   Adaptyは、インテグレーションで設定したすべてのサブスクリプションイベントをAdjustに送信できます。これにより、Adjustのダッシュボードでこれらのイベントを追跡できます。このインテグレーションは、広告キャンペーンの効果測定に役立ちます。

## インテグレーションの設定 \{#set-up-integration\}

### AdaptiをAdjustに接続する \{#connect-adapty-to-adjust\}

1. Adapty ダッシュボードを開き、[Integrations > Adjust](https://app.adapty.io/integrations/adjust) に移動します。

2. ページ上部のトグルをオンにします。

3. フィールドに入力し、アクセス認証情報を設定します。

  
    <img src="/assets/shared/img/5064125-CleanShot_2023-08-11_at_14.43.382x.webp"
    style={{
      border: '1px solid #727272', /* border width and color */
      width: '700px', /* image width */
      display: 'block', /* for alignment */
      margin: '0 auto' /* center alignment */
    }}
  />
  

3. AdjustプラットフォームでOAuth認証を有効にしている場合は、iOSおよびAndroidアプリのインテグレーション中に**OAuth Token**を提供することが必須です。
4. 次に、iOSおよびAndroidアプリの**app token**を入力します。Adjustのダッシュボードを開くと、登録済みのアプリが表示されます。

  
    <img src="/assets/shared/img/adjust-apps.webp"
    style={{
      border: '1px solid #727272', /* border width and color */
      width: '700px', /* image width */
      display: 'block', /* for alignment */
      margin: '0 auto' /* center alignment */
    }}
  />
  

  :::note
  iOSとAndroidで異なるAdjustアプリケーションを使用している場合があるため、Adaptyにはそれぞれ独立したセクションが用意されています。Adjustアプリが1つだけの場合は、同じ情報を両方に入力してください。
  :::

5. リストからアプリを選択し、**App Token**をコピーします。トークンをAdaptyダッシュボードの対応するフィールドに貼り付けます。

  <img src="/assets/shared/img/adjust-token.webp"
  style={{
    border: '1px solid #727272', /* border width and color */
    width: '700px', /* image width */
    display: 'block', /* for alignment */
    margin: '0 auto' /* center alignment */
  }}
/>

### イベントとタグの設定 \{#configure-events-and-tags\}

Adjustは他のプラットフォームとは少し異なる仕組みで動作します。Adjustのダッシュボードでイベントを手動で作成し、イベントトークンを取得して、Adaptyの対応するイベントに貼り付ける必要があります。

最初のステップは、Adaptyに送信したいすべてのイベントのイベントトークンを確認することです。手順は以下のとおりです：

1. Adjustのダッシュボードでアプリを開き、**Events**タブに切り替えます。

  <img src="/assets/shared/img/adjust-events.webp"
  style={{
    border: '1px solid #727272', /* border width and color */
    width: '700px', /* image width */
    display: 'block', /* for alignment */
    margin: '0 auto' /* center alignment */
  }}
/>

1. イベントトークンをコピーしてAdaptiに貼り付けます。認証情報の下には、AdaptiからAdjustに送信できるイベントが3つのグループに分かれて表示されます。Adaptyが提供するイベントの全リストは[こちら](events)で確認できます。

  <img src="/assets/shared/img/adjust-event-token.webp"
  style={{
    border: '1px solid #727272', /* border width and color */
    width: '700px', /* image width */
    display: 'block', /* for alignment */
    margin: '0 auto' /* center alignment */
  }}
/>

Adaptyはサーバー間インテグレーションを使用してサブスクリプションイベントをAdjustに送信するため、Adjustのダッシュボードですべてのサブスクリプションイベントを確認し、それらを広告獲得キャンペーンに関連付けることができます。

:::important
以下の点にご注意ください：

- Adjustは58日以上前のイベントをサポートしていません。58日を超えるイベントはAdaptiからAdjustに送信されますが、イベントの日時は現在のタイムスタンプに置き換えられます。
- AdjustはIPv6をサポートしていません。**App settings**またはSDKのアクティベーション時にSDKでのIP収集を無効にした場合、バックエンドのIPv6のみが送信され、トラッキングが失敗する可能性があります。IPv4が使用されるよう、SDKのIP収集は有効のままにしておいてください。

:::

### アプリをAdjustに接続する \{#connect-your-app-to-adjust\}

上記の手順が完了したら、以下の2つのメソッドをアプリに追加します。これらはアプリとAdjust間の通信を確立します：

1. **サブスクリプションデータをAdjustに送信する**: Adjustのデバイス IDを`setIntegrationIdentifier()` SDKメソッドに渡します。
2. **Adjustからアトリビューションデータを受け取る**: `updateAttribution()` SDKメソッドでアトリビューションデータを更新します。

Adjustバージョン5.0以降では、以下の例を使用してください：

<Tabs groupId="current-os" queryString>
<TabItem value="swift" label="iOS (Swift)" default>

```swift showLineNumbers
class AdjustModuleImplementation {
    func updateAdjustAdid() {
        Adjust.adid { adid in
            guard let adid else { return }
            // Adapty SDK 4.x
            Adapty.setIntegrationIdentifier(.adjustDeviceId(adid))
            // Adapty SDK 3.x
            Adapty.setIntegrationIdentifier(key: "adjust_device_id", value: adid)
        }
    }

    func updateAdjustAttribution() {
        Adjust.attribution { attribution in
            guard let attribution = attribution?.dictionary() else { return }
            // Adapty SDK 4.x
            Adapty.updateAttribution(attribution, source: .adjust)
            // Adapty SDK 3.x
            Adapty.updateAttribution(attribution, source: "adjust")
        }
    }
}
```

</TabItem>
<TabItem value="kotlin" label="Android (Kotlin)" default>

```kotlin showLineNumbers
Adjust.getAdid { adid ->
    if (adid == null) return@getAdid

    Adapty.setIntegrationIdentifier("adjust_device_id", adid) { error ->
        if (error != null) {
            // handle the error
        }
    }
}

Adjust.getAttribution { attribution ->
    if (attribution == null) return@getAttribution

    Adapty.updateAttribution(attribution, "adjust") { error ->
        // handle the error
    }
}
```

</TabItem>
<TabItem value="java" label="Android (Java)" default>

```java showLineNumbers
Adjust.getAdid(adid -> {
    if (adid == null) return;

    Adapty.setIntegrationIdentifier("adjust_device_id", adid, error -> {
        if (error != null) {
            // handle the error
        }
    });
});

Adjust.getAttribution(attribution -> {
    if (attribution == null) return;

    Adapty.updateAttribution(attribution, "adjust", error -> {
        // handle the error
    });
});
```

</TabItem>
<TabItem value="rn" label="React Native (TS)" default>

```typescript showLineNumbers

var adjustConfig = new AdjustConfig(appToken, environment);

// Before submiting Adjust config...
adjustConfig.setAttributionCallbackListener(attribution => {
  // Make sure Adapty SDK is activated at this point
  // You may want to lock this thread awaiting of `activate`
  adapty.updateAttribution(attribution, "adjust");
});

// ...
Adjust.create(adjustConfig);

Adjust.getAdid((adid) => {
  if (adid)
    adapty.setIntegrationIdentifier("adjust_device_id", adid);
});
```

</TabItem>

<TabItem value="flutter" label="Flutter" default>

```javascript showLineNumbers

try {
  final adid = await Adjust.getAdid();

  if (adid == null) {
    // handle the error
  }
  
  await Adapty().setIntegrationIdentifier(
    key: "adjust_device_id", 
    value: adid,
  );
    
  final attributionData = await Adjust.getAttribution();

  var attribution = Map<String, String>();

  if (attributionData.trackerToken != null) attribution['trackerToken'] = attributionData.trackerToken!;
  if (attributionData.trackerName != null) attribution['trackerName'] = attributionData.trackerName!;
  if (attributionData.network != null) attribution['network'] = attributionData.network!;
  if (attributionData.adgroup != null) attribution['adgroup'] = attributionData.adgroup!;
  if (attributionData.creative != null) attribution['creative'] = attributionData.creative!;
  if (attributionData.clickLabel != null) attribution['clickLabel'] = attributionData.clickLabel!;
  if (attributionData.costType != null) attribution['costType'] = attributionData.costType!;
  if (attributionData.costAmount != null) attribution['costAmount'] = attributionData.costAmount!.toString();
  if (attributionData.costCurrency != null) attribution['costCurrency'] = attributionData.costCurrency!;
  if (attributionData.fbInstallReferrer != null) attribution['fbInstallReferrer'] = attributionData.fbInstallReferrer!;

  await Adapty().updateAttribution(attribution, source: "adjust");
} on AdaptyError catch (adaptyError) {
  // handle the error
} catch (e) {
  // handle the error
}
```

</TabItem>

<TabItem value="unity" label="Unity" default>

```csharp showLineNumbers
// 1. To update ADID
Adjust.GetAdid((adid) => {
    if (adid == null) {
        // handle the error
        return;
    }

    Adapty.SetIntegrationIdentifier("adjust_device_id", adid, (error) => {
        if (error != null) {
            // handle the error
            return;
        }

    });
});

// 2. To update Attribution

// in your adjust configuration scope:
adjustConfig.AttributionChangedDelegate = AttributionChangedCallback;

public void AttributionChangedCallback(AdjustAttribution attributionData) {
    var attribution = new Dictionary<string, string>();

    if (attributionData.TrackerToken != null) attribution["trackerToken"] = attributionData.TrackerToken;
    if (attributionData.TrackerName != null) attribution["trackerName"] = attributionData.TrackerName;
    if (attributionData.Network != null) attribution["network"] = attributionData.Network;
    if (attributionData.Adgroup != null) attribution["adgroup"] = attributionData.Adgroup;
    if (attributionData.Creative != null) attribution["creative"] = attributionData.Creative;
    if (attributionData.ClickLabel != null) attribution["clickLabel"] = attributionData.ClickLabel;
    if (attributionData.CostType != null) attribution["costType"] = attributionData.CostType;
    if (attributionData.CostAmount != null) attribution["costAmount"] = attributionData.CostAmount.ToString();
    if (attributionData.CostCurrency != null) attribution["costCurrency"] = attributionData.CostCurrency;
    if (attributionData.FbInstallReferrer != null) attribution["fbInstallReferrer"] = attributionData.FbInstallReferrer;

    // you will probably need to install Newtonsoft.Json package, if not yet
    var attributionJsonString = Newtonsoft.Json.JsonConvert.SerializeObject(attribution);

    Adapty.UpdateAttribution(attributionJsonString, "adjust", (error) => {
        if (error != null) {
            // handle the error
        }
    });
}
```

</TabItem>

</Tabs>

## イベント構造 \{#event-structure\}

Adaptyは、[**Adjust Integration page**](https://app.adapty.io/integrations/adjust)の**Events names**セクションで設定された内容に従い、選択したイベントをAdjustに送信します。各イベントの構造は以下のとおりです：

```json
{
   "event_token": "EVENT_TOKEN_FROM_CONFIG",
   "app_token": "APP_TOKEN_FROM_CONFIG",
   "s2s": 1,
   "environment": "production",
   "created_at_unix": 1709294400,
   "currency": "USD",
   "revenue": 9.99,
   "customer_user_id": "user_12345",
   "external_device_id": "user_12345",
   "ip_address": "192.168.100.1",
   "user_agent": "Mozilla/5.0 (Linux; Android 14; SM-S901B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36",
   "android_id": "875646c2-4a56-4211-8931-168532479006",
   "gps_adid": "875646c2-4a56-4211-8931-168532479006",
   "callback_params": "{\"integration_event_id\":\"550e8400-e29b-41d4-a716-446655440000\",\"customer_user_id\":\"user_12345\",\"vendor_product_id\":\"com.example.app.yearly.premium\",\"transaction_id\":\"GPA.3312-4512-1100-55923\",\"original_transaction_id\":\"GPA.3312-4512-1100-55923\",\"store\":\"play_store\",\"store_country\":\"US\",\"price_usd\":9.99,\"proceeds_usd\":8.49,\"price_local\":9.99,\"proceeds_local\":8.49,\"net_revenue_usd\":8.49,\"net_revenue_local\":8.49,\"tax_amount_usd\":0.0,\"tax_amount_local\":0.0,\"consecutive_payments\":3,\"rate_after_first_year\":false}",
   "partner_params": "{\"integration_event_id\":\"550e8400-e29b-41d4-a716-446655440000\",\"customer_user_id\":\"user_12345\",\"vendor_product_id\":\"com.example.app.yearly.premium\",\"transaction_id\":\"GPA.3312-4512-1100-55923\",\"original_transaction_id\":\"GPA.3312-4512-1100-55923\",\"store\":\"play_store\",\"store_country\":\"US\",\"price_usd\":9.99,\"proceeds_usd\":8.49,\"price_local\":9.99,\"proceeds_local\":8.49,\"net_revenue_usd\":8.49,\"net_revenue_local\":8.49,\"tax_amount_usd\":0.0,\"tax_amount_local\":0.0,\"consecutive_payments\":3,\"rate_after_first_year\":false}"
}
```

各パラメーターの説明：

| パラメーター         | 型       | 説明                                                                                                                                         |
|:---------------------|:--------|:---------------------------------------------------------------------------------------------------------------------------------------------|
| `app_token`          | String  | インテグレーション設定に登録されているAdjustのApp Token。                                                                                    |
| `event_token`        | String  | 特定のAdaptiイベントに対応するAdjustのEvent Token。                                                                                          |
| `s2s`                | Integer | サーバー間イベントフラグ。                                                                                                                   |
| `environment`        | String  | `sandbox` または `production`。                                                                                                              |
| `created_at_unix`    | Integer | イベントのタイムスタンプ（秒単位）。                                                                                                         |
| `currency`           | String  | 取引の通貨コード（例: "USD"）。収益が0.001を超える場合にのみ含まれます。AdjustはrevenueとcurrencyをセットでRequireするためです。              |
| `revenue`            | Float   | 取引の収益額。値が0.001を超える場合にのみ含まれます。なお、返金イベントはrevenue属性なしで送信されます（Adjustは負の収益値をサポートしていないため）。 |
| `customer_user_id`   | String  | ユーザーのCustomer User ID。                                                                                                                 |
| `external_device_id` | String  | `customer_user_id`と同じ値。                                                                                                                 |
| `ip_address`         | String  | ユーザーのIPアドレス（IPv4のみ）。                                                                                                           |
| `user_agent`         | String  | デバイスのUser Agent文字列。                                                                                                                 |
| `adid`               | String  | AdjustのデバイスID（判明している場合）。                                                                                                     |
| `android_id`         | String  | **Androidのみ**。Google Advertising ID。                                                                                                     |
| `gps_adid`           | String  | **Androidのみ**。Google Advertising ID。                                                                                                     |
| `idfa`               | String  | **iOSのみ**。広告主向け識別子（IDFA）。                                                                                                      |
| `idfv`               | String  | **iOSのみ**。ベンダー向け識別子（IDFV）。                                                                                                    |
| `callback_params`    | String  | 利用可能な[イベントフィールド](webhook-event-types-and-fields#for-most-event-types)をすべて含むJSON文字列。null以外のフィールドのみが含まれます。 |
| `partner_params`     | String  | `callback_params`と同じ内容。                                                                                                                |

## トラブルシューティング \{#troubleshooting\}

### 収益の不一致 \{#revenue-discrepancy\}

AdaptiとAdjust間で収益に差異がある場合、Adapty SDKを含むアプリバージョンを使用していないユーザーが存在することが原因として考えられます。データの一貫性を確保するには、Adapty SDKを搭載したバージョンへのアップデートをユーザーに促すことをお勧めします。