使用此集成前,请阅读关于使用您的部分数据的条款。
您可以按照此指南的说明集成 Adjust SDK 和 Mixpanel SDK。
操作前须知
要使用该功能,请先下载并设置 Adjust Android SDK。
指南
Mixpanel API 允许您注册 “超级属性”。这些属性可随所有活动发送。请参考Mixpanel 的文档了解更多信息。
要集成 Adjust SDK 和 Mixpanel SDK,您需要注册 “超级属性” (super properties)。
收到 Adjust 服务器响应后,您应该发送此信息。为此,请按照归因回传指南中的 Android 说明进行操作。
示例
如下方所示调整回传方法来使用 Mixpanel API:
public class YourApplicationClass extends Application { @Override public void onCreate() { super.onCreate(); // Configure Adjust. AdjustConfig config = new AdjustConfig(this, appToken, environment);
config.setOnAttributionChangedListener(new OnAttributionChangedListener() { @Override public void onAttributionChanged(AdjustAttribution attribution) { MixpanelAPI mixpanel = MixpanelAPI.getInstance(context, MIXPANEL_TOKEN);
// The Adjust properties will be sent with all future track calls. JSONObject props = new JSONObject(); insertJsonProperty(props, "[Adjust]Network", attribution.network); insertJsonProperty(props, "[Adjust]Campaign", attribution.campaign); insertJsonProperty(props, "[Adjust]Adgroup", attribution.adgroup); insertJsonProperty(props, "[Adjust]Creative", attribution.creative);
if (props.length() > 0) { mixpanel.registerSuperProperties(props); } }
private void insertJsonProperty(JSONObject props, String name, String value) { try { if (value != null) { props.put(name, value); } } catch(JSONException e) { } } });
Adjust.onCreate(config); }}