Menu

Integration Guide (Android)

Integration

Configure Dependencies

Inapp/build.gradlefile, reference the third-party integration dependencies as shown below:

implementation 'com.sensorsdata.analytics.android:ThirdParty:0.0.3'

For specific implementation, please refer to: https://github.com/sensorsdata/SensorsThirdParty

Usage

API Introduction

The SensorsThirdParty provides a share method to achieve third-party data integration, the specific parameter definitions are as follows:

ParameterTypeDescription

thirdPartyName

SAThirdPartyName

An enumerated type, such as SAThirdPartyName.APPSFLYER represents AppsFlyer

data

Map<String,Object>

The shared data, a Map type


Integrating with AppsFlyer

Call the share method before calling the start method in the AppsFlyer SDK, as shown in the example below:

// 初始化 AppsFlyer SDK AppsFlyerLib.getInstance().init("appid", conversionListener, context) ... // 初始化神策 SDK val saConfigOptions = SAConfigOptions("数据接收地址") ... SensorsDataAPI.startWithConfigOptions(context, saConfigOptions) // 在调用 AppsFlyer SDK start 方法前调用 share 方法 val customParams: MutableMap<String, Any> = HashMap() customParams["key1"] = "value1" customParams["key2"] = "value2" SensorsThirdParty.share(SAThirdPartyName.APPSFLYER, customParams)   // 调用 AppsFlyer SDK 的 start,请注意按照 AppsFlyer SDK 的集成要求来调用 start 方法,这里只是举例来说明 share 方法需要在 start 方法前调用 AppsFlyerLib.getInstance().start(context)
  • Require AppsFlyer SDK version &gt;= 6.0.0
  • The setAdditionalData interface of AppsFlyer SDK will overwrite the data each time. Please use the SensorsThirdParty.share method to set shared data directly, otherwise it will overwrite the Sensors Analytics identification property. The SensorsThirdParty.share method can merge shared data when called multiple times.
  • Call the share method before start method of AppFlyer, otherwise the Sensors Analytics identification property will not be carried in the AppsFlyer activation event, which will affect the attribution analysis.
  • The shared data set by the SensorsThirdParty.share method supports in-app events.


Integration with Adjust

Call the share method before the Adjust SDK

//初始化神策 SDK initSensorsSDK() val customParams: MutableMap<String, Any> = HashMap() customParams["key1"] = "value1" customParams["key2"] = "value2" // 在调用 Adjust SDK 初始化之前调用 share 方法 SensorsThirdParty.share(SAThirdPartyName.ADJUST, customParams) //初始化 Adjust SDK initAdjustSDK()


  • Call the share method before initializing the Adjust SDK, otherwise the Adjust activation event will not carry the Sensors Analytics identification property, affecting attribution analysis
    • Initialize the Sensors SDK → share → initialize the Adjust SDK
  • If you call the resetSessionCallbackParameters method, the Sensors Analytics user identification will be cleared and you need to call the share method again
  • Require SensorsThirdParty version &gt;= 0.0.3




Previous
Third-party Data
Next
Integration Guide (iOS)
Last modified: 2024-12-27