帮助中心
|
Batch.com SDK 集成
您可以使用以下方法之一实现 Adjust SDK 与 Batch.com 事件的集成。
操作前须知
要使用该功能,请先为您的平台下载并设置对应的 Adjust SDK。按照下方链接中的说明操作,开始使用功能。
要集成 Adjust 和 Batch.com SDK,您需要将归因发送到 Batch.com SDK。收到 Adjust 后端响应后,您应该发送此信息。为此,请按照归因回传指南中相应平台的说明进行操作。
示例
您可通过以下方式设置回传方法:
Objective-C
- (void)adjustAttributionChanged:(ADJAttribution *)attribution {
// initiate Batch user editor to set new attributes
BatchUserDataEditor *editor = [BatchUser editor];
if (attribution.network != nil)
[editor setAttribute:attribution.network forKey:@"adjust_network"];
if (attribution.campaign != nil)
[editor setAttribute:attribution.campaign forKey:@"adjust_campaign"];
if (attribution.adgroup != nil)
[editor setAttribute:attribution.adgroup forKey:@"adjust_adgroup"];
if (attribution.creative != nil)
[editor setAttribute:attribution.creative forKey:@"adjust_creative"];
// send new attributes to Batch servers
[editor save];
}
Swift
func adjustAttributionChanged(_ attribution: ADJAttribution?) {
// initiate Batch user editor to set new attributes
let editor = BatchUser.editor()
if attribution?.network != nil {
editor?.setAttribute(attribution?.network, forKey: "adjust_network")
}
if attribution?.campaign != nil {
editor?.setAttribute(attribution?.campaign, forKey: "adjust_campaign")
}
if attribution?.adgroup != nil {
editor?.setAttribute(attribution?.campaign, forKey: "adjust_adgroup")
}
if attribution?.creative != nil {
editor?.setAttribute(attribution?.creative, forKey: "adjust_creative")
}
// send new attribute to Batch servers
editor.save()
}
Java
AdjustConfig config = new AdjustConfig(this, appToken, environment);
config.setOnAttributionChangedListener(newOnAttributionChangedListener() {
@Override
public void onAttributionChanged(AdjustAttribution attribution) {
// Initiate Batch user editor to set new attributes.
BatchUserDataEditor editor = Batch.User.editor();
if (attribution.network != null) {
editor.setAttribute("adjust_network",attribution.network);
}
if (attribution.campaign != null) {
editor.setAttribute("adjust_campaign",attribution.campaign);
}
if (attribution.adgroup != null) {
editor.setAttribute("adjust_adgroup",attribution.adgroup);
}
if (attribution.creative != null) {
editor.setAttribute("adjust_creative",attribution.creative);
}
// Send new attributes to Batch servers.
editor.save();
}
});
Adjust.onCreate(config);