---
code: android_sdk_thirdparty
name: "三方数据"
wikiToken: TL4NwhIrriKNZ8k7mbVcQDAenTb
parentWikiToken: J7zFwvYawiv1E6k6TsYc5YzXnLc
updateTime: 1750746373000
sourceUrl: https://docs-v2.thinkingdata.cn/?version=v5.0&lan=zh-CN&code=android_sdk_thirdparty
---
# 三方数据

<!-- unsupported block: 19 -->

如果采集SDK的版本低于3.0.0，插件版本需要使用1.3.0，如果采集SDK的版本大于等于3.0.0，插件版本需要大于2.0.0

```
implementation 'cn.thinkingdata.android:TAThirdParty:2.0.2'
```

以下是同步多个平台数据的示例代码:

:::: el-tabs

::: el-tab-pane label=Java

```
TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*APPS_FLYER *| TDThirdPartyType.*ADJUST*);
```

:::

::: el-tab-pane label=Kotlin

```
TDAnalytics.enableThirdPartySharing(TDThirdPartyType.APPS_FLYER or TDThirdPartyType.ADJUST)
```

:::

::::

<!-- unsupported block: 34 -->

如果需要增加额外参数，可以使用`enableThirdPartySharing(int var1, Map<String, Object> var2)`，该API不支持位运算

如果使用了 proguard，为了防止功能失效，需要在配置文件中加入以下内容：

```
-dontwarn cn.thinkingdata.thirdparty.**
-keep class cn.thinkingdata.thirdparty.** { *; }
-keep class cn.thinkingdata.module.routes.** { *; }
```

### 1. Appsflyer

在AppsFlyer SDK调用start方法之前调用API:

:::: el-tabs

::: el-tab-pane label=Java

```
TDAnalytics.enableThirdPartySharing(TDThirdPartyType.*APPS_FLYER*);
```

:::

::: el-tab-pane label=Kotlin

```
TDAnalytics.enableThirdPartySharing(TDThirdPartyType.*APPS_FLYER*)
```

:::

::::

注册创角色之后(可选)： 

:::: el-tabs

::: el-tab-pane label=Java

```
TDAnalytics.login("account_id")
TDAnalytics.enableThirdPartySharing(TDThirdPartyType.*APPS_FLYER*);
```

:::

::: el-tab-pane label=Kotlin

```
TDAnalytics.login("account_id")
TDAnalytics.enableThirdPartySharing(TDThirdPartyType.*APPS_FLYER*)
```

:::

::::

每次调用了TE的`login`方法或者`identify`方法，您需要同步调用enableThirdPartySharing更新用户标识。

注意:由于AppFlyer的setAdditionalData每次调用，会覆盖设置的用户标识。您可以通过我们提供的`enableThirdPartySharing`方法设置参数:

:::: el-tabs

::: el-tab-pane label=Java

```
Map<String, Object> additionalData = new HashMap<>();
additionalData.put("af_test_key1", "test1");
additionalData.put("af_test_key2", "test2");
TDAnalytics.enableThirdPartySharing(
    TDThirdPartyType.*APPS_FLYER*,
    additionalData
)
```

:::

::: el-tab-pane label=Kotlin

```
val additionalData: MutableMap<String, Any> = HashMap()
additionalData["af_test_key1"] = "test1"
additionalData["af_test_key2"] = "test2"
TDAnalytics.enableThirdPartySharing(
    TDThirdPartyType.*APPS_FLYER*,
    additionalData
)
```

:::

::::

### 2. Adjust

在Adjust SDK初始化之前调用: 

:::: el-tabs

::: el-tab-pane label=Java

```
TDAnalytics.enableThirdPartySharing(TDThirdPartyType.*ADJUST*);
```

:::

::: el-tab-pane label=Kotlin

```
TDAnalytics.enableThirdPartySharing(TDThirdPartyType.*ADJUST*)
```

:::

::::

注册创角色之后(可选):

:::: el-tabs

::: el-tab-pane label=Java

```
TDAnalytics.login("accoount_id")
TDAnalytics.enableThirdPartySharing(TDThirdPartyType.*ADJUST*);
```

:::

::: el-tab-pane label=Kotlin

```
TDAnalytics.login("accoount_id")
TDAnalytics.enableThirdPartySharing(TDThirdPartyType.*ADJUST*)
```

:::

::::

### 3. Branch

在Branch initialize the session之前调用:

:::: el-tabs

::: el-tab-pane label=Java

```
TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*BRANCH*);
```

:::

::: el-tab-pane label=Kotlin

```
TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*BRANCH*)
```

:::

::::

注册创角色之后(可选):

:::: el-tabs

::: el-tab-pane label=Java

```
TDAnalytics.login("accoount_id")
TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*BRANCH*);
```

:::

::: el-tab-pane label=Kotlin

```
TDAnalytics.login("accoount_id")
TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*BRANCH*)
```

:::

::::

### 4. TopOn

在ATSDK.*init之前调用:*

:::: el-tabs

::: el-tab-pane label=Java

```
TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*TOP_ON*);
```

:::

::: el-tab-pane label=Kotlin

```
TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*TOP_ON*)
```

:::

::::

多次调用TE的`login`或者`identify`，需要再次调用enableThirdPartySharing同步数据。

注意:由于TopOn的initCustomMap每次调用，会覆盖设置的用户标识。您可以通过我们提供的`enableThirdPartySharing`方法设置参数:

:::: el-tabs

::: el-tab-pane label=Java

```
Map<String, Object> customMap = new HashMap<>();
customMap.put("key1", "value1");
customMap.put("key2", "value2");
TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*TOP_ON, customMap*);
```

:::

::: el-tab-pane label=Kotlin

```
val customMap: MutableMap<String, Any> = HashMap()
customMap["key1"] = "value1"
customMap["key2"] = "value2"
TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*TOP_ON, customMap*)
```

:::

::::

### 5. Tradplus

在TradPlusSdk.*initSdk之前调用：*

:::: el-tabs

::: el-tab-pane label=Java

```
TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*TRAD_PLUS*);
```

:::

::: el-tab-pane label=Kotlin

```
TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*TRAD_PLUS*)
```

:::

::::

### 6. IronSource

在IronSourceSdk初始化之后调用:

:::: el-tabs

::: el-tab-pane label=Java

```
TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*IRON_SOURCE*);
```

:::

::: el-tab-pane label=Kotlin

```
TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*IRON_SOURCE*)
```

:::

::::

### 7. AppLovin

- 展示级别
在AppLovinSdk初始化之前调用:

:::: el-tabs

::: el-tab-pane label=Java

```
TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*APPLOVIN_IMPRESSION*);
```

:::

::: el-tab-pane label=Kotlin

```
TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*APPLOVIN_IMPRESSION*)
```

:::

::::

- 用户级别
如果要实现变现数据获取，您需要创建 `MaxAdRevenueListener`，并复写 `onAdRevenuePaid()` 方法，在该方法中获取变现数据并且通过 AE SDK 的`enableThirdPartySharing`进行数据上报，最后将该监听器传递给 setRevenueListener()，示例代码如下：

```
void onAdRevenuePaid(final MaxAd ad){
    TDAnalytics.*enableThirdPartySharing*(TDThirdPartyType.*APPLOVIN_USER,ad*);
}
```
