参考文档:https://docs.adjust.com/zh/sdk/android/#session-tracking-api9
第一步:在build.gradle添加依赖:
implementation'com.adjust.sdk:adjust-android:4.13.0'
implementation'com.android.installreferrer:installreferrer:1.0'
第二步:在AppActivity.java里添加
import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustConfig;
...
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
String appToken ="{你的appToken}";
String environment = AdjustConfig.ENVIRONMENT_SANDBOX;
// 发布时改成正式
// String environment = AdjustConfig.ENVIRONMENT_PRODUCTION;
AdjustConfig config =new AdjustConfig(this, appToken, environment);
Adjust.onCreate(config);
第三步:添加跟踪事件:
AdjustEvent event =new AdjustEvent(eventName);
Adjust.trackEvent(event);
网友评论