标准事件
系统默认已经有的事件
login (登录事件)
APP侧用户有登录操作调用此事件 对于活动,调用此事件可以自动拉起之前未登录的活动页面,不需要在onSuccess处手动调用loadUrl。
// 除用户ID外,可以为空
TurboLink.DefaultEvent.login(this, "<你的app用户ID/加密后的用户ID>", "<昵称>", "<用户头像URL>", arrayOf("<用户类型>"), "<邀请码>")
.build(object : TurboLinkEvent.TurboLinkEventCallback {
override fun onSuccess(response: EventResponse) {
}
override fun onFailure(code: Int, msg: String) {
}
})logout (登出事件)
APP侧用户有登出操作调用此事件
TurboLink.DefaultEvent.logout(this).build()register (注册事件)
APP侧用户有注册操作调用此事件
TurboLink.DefaultEvent.register(this, "<你的app用户ID/加密后的用户ID>", "<昵称>", "<用户头像URL>", arrayOf("<用户类型>"), "<邀请码>")
.build(object : TurboLinkEvent.TurboLinkEventCallback {
override fun onSuccess(response: EventResponse) {
}
override fun onFailure(code : Int, msg : String) {
}
})tl_add_to_cart (加购事件)
电商类的加入购物车时可调用此方法
val addtoCartProperties = EventAddtoCartProperties()
.setPrice(<商品价格,单位为分>)
.setCurrency("<货币单位,USD CNY>")
.setProductId("<商品ID>")
.setProductName("<商品名称>")
.setProductQuantity(<加购商品数量>)
.setProductType("<商品分类,shoes>")
TurboLink.DefaultEvent.addtoCart(this, addtoCartProperties).build()click (深度链接点击事件)
点击事件可以返回link_data数据,就是深度链接和活动自定义的Key:Value,App端可以根据自定义的Key:Value做动态的页面跳转
TurboLink.DefaultEvent.click(this, "<深度链接ID>")
.build(object : TurboLinkEvent.TurboLinkEventCallback {
override fun onSuccess(response: EventResponse) {
}
override fun onFailure(code : Int, msg : String) {
}
})code_search (口令搜索)
通过获得粘贴板内容并调用此方法可以对口令内容做归因,场景:像TikTok之类的不能直接放链接的平台。
TurboLink.DefaultEvent.codeSearch(this, "<口令内容>").build(
// 如果需要回调autoInstance的TurboLinkEventCallback,这里不用设置
object :TurboLinkEvent.TurboLinkEventCallback {
override fun onSuccess(response: EventResponse) {
}
override fun onFailure(code: Int, msg: String) {
}
}
)自定义事件
需要先在Dashboard后台创建好对应的事件Key:Value
在Activity页面执行:
val customData = TurboLinkCustomProperties()
.addKeyValue("<事件对应的key>", "<事件对应的value>")
.addKeyValue("<事件对应的key2>", "<事件对应的value2>")
TurboLink.customEvent(this, "<你定义的事件ID>")
.setCustomProperties(customData)
.build(object : TurboLinkEvent.TurboLinkEventCallback {
override fun onSuccess(response: EventResponse) {
}
override fun onFailure(code: Int, msg: String) {
}
})初始化SDK方法结果Callback
事件上报后的Callback,如果在事件上报时已经包含了Callback,就以上报时绑定的为主
TurboLink.withEventCallback(object : TurboLinkEvent.TurboLinkEventCallback {
override fun onSuccess(response: EventResponse) {
}
override fun onFailure(code: Int, msg: String) {
}
})