您可以采用适用于 Adobe Experience SDK 的 Adjust Extension,在用户执行特定操作时,向 Adjust 服务器发送事件信息。Adjust 会记录这些事件并在您的Datascape 报告、服务器回传和云存储上传中显示。
有关在 Adjust 中配置事件的更多信息,请参阅帮助中心的添加事件指南。
工作原理
下列信息被传递至 MobileCore.track
API 时,事件信息将被发送至 Adjust:
ADJAdobeAdjustActionTrackEvent
: 映射到 Adjust trackEvent
方法的字符串值。
data
: 用于配置事件的值字典。
当您使用这些参数调用 MobileCore.track
时,Adjust Extension 会创建一个事件实例,将该实例传递至 trackEvent
方法,然后将信息发送至 Adjust。
参考
data
字典中包含事件相关的信息。每个事件都由唯一的data
字典代表。要配置事件实例,请将值添加至字典。
受支持的键如下:
ADJAdobeAdjustEventToken
-
您的 Adjust 事件识别码。您必须设置该值,才能向 Adjust 发送事件信息。请参阅添加事件了解更多信息。
ADJAdobeAdjustEventRevenue
-
事件相关的收入额。应当是代表数值的字符串。
ADJAdobeAdjustEventCurrency
.
-
ISO 4217 货币代码。
ADJAdobeAdjustEventCallbackParamPrefix
-
将回传参数键附加到此前缀,并添加您的回传参数值,以向 Adjust 发送回传。
ADJAdobeAdjustEventPartnerParamPrefix
-
将合作伙伴参数键附加到此前缀,并添加您的合作伙伴参数值,以向第三方发送回传。
教程:发送事件
要发送事件信息,您需要向主要活动添加一个函数。参阅本教程,您将以集成指南中的 View Controller 为基础,向 Adjust 发送带有下列属性的新事件:
- 事件识别码:
"g3mfiw"
。
- 1 欧元的事件收入。
- 带有键
"user_id"
和值 "855"
的回传参数。
- 带有键
"event_token
和值 "g3mfiw"
的合作伙伴参数。
最终结果将如下:
import AdjustAdobeExtension
class ViewController: UIViewController {
override func viewDidLoad() {
var dataDict: Dictionary = [String : String]()
dataDict[ADJAdobeAdjustEventToken] = "g3mfiw"
dataDict[ADJAdobeAdjustEventRevenue] = "0.01"
dataDict[ADJAdobeAdjustEventCurrency] = "EUR"
dataDict[ADJAdobeAdjustEventCallbackParamPrefix.appending("user_id")] = "855"
dataDict[ADJAdobeAdjustEventPartnerParamPrefix.appending("event_token")] = "g3mfiw"
MobileCore.track(action: ADJAdobeAdjustActionTrackEvent, data: dataDict)
#import "ViewController.h"
#import <AdjustAdobeExtension/AdjustAdobeExtension.h>
@implementation ViewController
NSMutableDictionary * dataDict = [NSMutableDictionary dictionary];
[dataDict setValue:@"g3mfiw" forKey:ADJAdobeAdjustEventToken];
[dataDict setValue:@"1.0" forKey:ADJAdobeAdjustEventRevenue];
[dataDict setValue:@"EUR" forKey:ADJAdobeAdjustEventCurrency];
[dataDict setValue:@"855" forKey:[ADJAdobeAdjustEventCallbackParamPrefix stringByAppendingString:@"user_id"]];
[dataDict setValue:@"855" forKey:[ADJAdobeAdjustEventPartnerParamPrefix stringByAppendingString:@"event_token"]];
[AEPMobileCore trackAction:ADJAdobeAdjustActionTrackEvent
[dataDict removeAllObjects];
您需要进行下列操作:
- 在
viewDidLoad
函数块中创建一个名为 dataDict
的新字典,用于保存事件的属性。
override func viewDidLoad() {
var dataDict: Dictionary = [String : String]()
NSMutableDictionary * dataDict = [NSMutableDictionary dictionary];
- 使用
ADJAdobeAdjustEventToken
键,将 Adjust 事件识别码添加至字典。您必须提供此信息,Adjust 才能了解您要发送的事件。
override func viewDidLoad() {
var dataDict: Dictionary = [String : String]()
dataDict[ADJAdobeAdjustEventToken] = "g3mfiw"
NSMutableDictionary * dataDict = [NSMutableDictionary dictionary];
[dataDict setValue:@"g3mfiw" forKey:ADJAdobeAdjustEventToken];
- 要添加事件收入金额,请针对金额使用
ADJAdobeAdjustEventRevenue
,针对币种使用 ADJAdobeAdjustEventCurrency
。两个值都必须以字符串形式传递。
override func viewDidLoad() {
var dataDict: Dictionary = [String : String]()
dataDict[ADJAdobeAdjustEventToken] = "g3mfiw"
dataDict[ADJAdobeAdjustEventRevenue] = "0.01"
dataDict[ADJAdobeAdjustEventCurrency] = "EUR"
NSMutableDictionary * dataDict = [NSMutableDictionary dictionary];
[dataDict setValue:@"g3mfiw" forKey:ADJAdobeAdjustEventToken];
[dataDict setValue:@"1.0" forKey:ADJAdobeAdjustEventRevenue];
[dataDict setValue:@"EUR" forKey:ADJAdobeAdjustEventCurrency];
- 使用
ADJAdobeAdjustEventCallbackParamPrefix
键添加回传参数。将回传标识符附加到键,以匹配回传 URL 中的参数。
override func viewDidLoad() {
var dataDict: Dictionary = [String : String]()
dataDict[ADJAdobeAdjustEventToken] = "g3mfiw"
dataDict[ADJAdobeAdjustEventRevenue] = "0.01"
dataDict[ADJAdobeAdjustEventCurrency] = "EUR"
dataDict[ADJAdobeAdjustEventCallbackParamPrefix.appending("user_id")] = "855"
NSMutableDictionary * dataDict = [NSMutableDictionary dictionary];
[dataDict setValue:@"g3mfiw" forKey:ADJAdobeAdjustEventToken];
[dataDict setValue:@"1.0" forKey:ADJAdobeAdjustEventRevenue];
[dataDict setValue:@"EUR" forKey:ADJAdobeAdjustEventCurrency];
[dataDict setValue:@"855" forKey:[ADJAdobeAdjustEventCallbackParamPrefix stringByAppendingString:@"user_id"]];
- 使用
ADJAdobeAdjustEventPartnerParamPrefix
键添加合作伙伴参数。将回传标识符附加到键,将其映射至合作伙伴的占位符。
override func viewDidLoad() {
var dataDict: Dictionary = [String : String]()
dataDict[ADJAdobeAdjustEventToken] = "g3mfiw"
dataDict[ADJAdobeAdjustEventRevenue] = "0.01"
dataDict[ADJAdobeAdjustEventCurrency] = "EUR"
dataDict[ADJAdobeAdjustEventCallbackParamPrefix.appending("user_id")] = "855"
dataDict[ADJAdobeAdjustEventPartnerParamPrefix.appending("event_token")] = "g3mfiw"
NSMutableDictionary * dataDict = [NSMutableDictionary dictionary];
[dataDict setValue:@"g3mfiw" forKey:ADJAdobeAdjustEventToken];
[dataDict setValue:@"1.0" forKey:ADJAdobeAdjustEventRevenue];
[dataDict setValue:@"EUR" forKey:ADJAdobeAdjustEventCurrency];
[dataDict setValue:@"855" forKey:[ADJAdobeAdjustEventCallbackParamPrefix stringByAppendingString:@"user_id"]];
[dataDict setValue:@"855" forKey:[ADJAdobeAdjustEventPartnerParamPrefix stringByAppendingString:@"event_token"]];
- 最后,要向 Adjust 发送事件信息,请使用
ADJAdobeAdjustActionTrackEvent
和 dataDict
字典调用 MobileCore.track
。如果您使用的是 Objective-C,请在 dataDict
字典中调用 removeAllObjects
,来解除分配。
override func viewDidLoad() {
var dataDict: Dictionary = [String : String]()
dataDict[ADJAdobeAdjustEventToken] = "g3mfiw"
dataDict[ADJAdobeAdjustEventRevenue] = "0.01"
dataDict[ADJAdobeAdjustEventCurrency] = "EUR"
dataDict[ADJAdobeAdjustEventCallbackParamPrefix.appending("user_id")] = "855"
dataDict[ADJAdobeAdjustEventPartnerParamPrefix.appending("event_token")] = "g3mfiw"
MobileCore.track(action: ADJAdobeAdjustActionTrackEvent, data: dataDict)
NSMutableDictionary * dataDict = [NSMutableDictionary dictionary];
[dataDict setValue:@"g3mfiw" forKey:ADJAdobeAdjustEventToken];
[dataDict setValue:@"1.0" forKey:ADJAdobeAdjustEventRevenue];
[dataDict setValue:@"EUR" forKey:ADJAdobeAdjustEventCurrency];
[dataDict setValue:@"855" forKey:[ADJAdobeAdjustEventCallbackParamPrefix stringByAppendingString:@"user_id"]];
[dataDict setValue:@"855" forKey:[ADJAdobeAdjustEventPartnerParamPrefix stringByAppendingString:@"event_token"]];
[AEPMobileCore trackAction:ADJAdobeAdjustActionTrackEvent
[dataDict removeAllObjects];
完成了!现在,您的 View Controller 会创建事件,并将其发送给 Adjust。