巨量引擎营销归因(转化 SDK)
提供启动事件上报、深度转化事件上报与营销归因能力。
setListener
event
{ action, data }
action
onEventSendSuccess
onEventSendFailure
onOtherError
const bd = ymx.requirePlugin('ymx-bytedance-convert') as YmxBytedanceConvert;// 插件在用户同意隐私协议后自动初始化并上报启动事件(无需手动调用)// 上报【注册】事件await bd.logEventRegister({ channel: 'weixin', success: true});// 上报【付费】事件await bd.logEventPurchase({ goodsType: 'vip', goodsName: 'vip12', goodsId: 'abc123', count: 1, paymentChannel: 'weixin', currency: 'CNY', amount: 123, success: true});// 上报自定义事件await bd.logEvent({ name: 'update_level', values: { test: 'test_params' }}); 复制
const bd = ymx.requirePlugin('ymx-bytedance-convert') as YmxBytedanceConvert;// 插件在用户同意隐私协议后自动初始化并上报启动事件(无需手动调用)// 上报【注册】事件await bd.logEventRegister({ channel: 'weixin', success: true});// 上报【付费】事件await bd.logEventPurchase({ goodsType: 'vip', goodsName: 'vip12', goodsId: 'abc123', count: 1, paymentChannel: 'weixin', currency: 'CNY', amount: 123, success: true});// 上报自定义事件await bd.logEvent({ name: 'update_level', values: { test: 'test_params' }});
只读
获取插件 ID
获取插件版本,如 1.2.3
1.2.3
上报自定义事件
上报任意自定义事件(事件名与参数键值对),如关键行为、游戏深度事件等。
自定义事件参数
await bd.logEvent({ name: 'game_addiction', values: { origin_event: '原始事件名称' }}); 复制
await bd.logEvent({ name: 'game_addiction', values: { origin_event: '原始事件名称' }});
上报创建角色事件(游戏类)
创建角色事件参数
await bd.logEventCreateRole({ roleId: 'role_001' }); 复制
await bd.logEventCreateRole({ roleId: 'role_001' });
上报关键行为事件(游戏类)
关键行为事件参数
await bd.logEventGameAddiction({ originEvent: '原始事件名称' }); 复制
await bd.logEventGameAddiction({ originEvent: '原始事件名称' });
上报升级事件(游戏类)
升级事件参数
await bd.logEventLevelUpdate({ level: 12 }); 复制
await bd.logEventLevelUpdate({ level: 12 });
上报登录事件
登录事件参数
await bd.logEventLogin({ method: 'weixin', success: true}); 复制
await bd.logEventLogin({ method: 'weixin', success: true});
上报付费事件
付费事件参数
await bd.logEventPurchase({ goodsType: 'vip', goodsName: 'vip12', goodsId: 'abc123', count: 1, paymentChannel: 'weixin', currency: 'CNY', amount: 123, success: true}); 复制
await bd.logEventPurchase({ goodsType: 'vip', goodsName: 'vip12', goodsId: 'abc123', count: 1, paymentChannel: 'weixin', currency: 'CNY', amount: 123, success: true});
上报注册事件
注册事件参数
await bd.logEventRegister({ channel: 'weixin', success: true}); 复制
await bd.logEventRegister({ channel: 'weixin', success: true});
移除监听器
手动上报启动事件
插件自动初始化时已自动上报启动事件,一般无需手动调用; 仅在自动上报失败或需要补充上报时调用。调用后 SDK 采集设备信息,请确保已获得用户同意。
await bd.sendLaunchEvent(); 复制
await bd.sendLaunchEvent();
设置监听器,接收 eventName 事件名称,data 事件数据
注意: 此接口为覆盖操作,仅保留最后一个监听器,最后的 listener 才能收到事件通知。
巨量引擎营销归因(转化 SDK)
提供启动事件上报、深度转化事件上报与营销归因能力。
setListener以 eventNameevent异步回传, 回调 data 为{ action, data }结构,action取值onEventSendSuccess/onEventSendFailure/onOtherError,推荐在回调中验证上报是否正常示例