sensor-tracker
v1.0.1
Published
sensor-sdk的封装
Downloads
13
Readme
使用
根据神策官方文档你需要传递这些参数
config
// config配置
const config = {
sdk_url: 'xxx',
name: 'xxx',
server_url: 'xxx',
config_url: 'xxx',
vtrack_js_file: 'xxx',
vtrack_css_file: 'xxx',
web_url: 'xxx',
heatmap: {}
}
公共事件属性(commonAttr)
// 支持公共事件属性
const commonAttr={
name:"xxx",
age:"xxx"
}
关于JWT
❗️我们需要你的JWT信息内包含oid
字段,可让后端支持
// 需要你传入获取JWT数据的方法
function getJWT(){
}
具体使用
trackerLoaded会返回一个函数,你可以选择把这个函数挂载到window上
window.sensor=trackerLoaded(config,commonAttr,getJWT)
window.sensors.tracks('ButtonClick', {
Button0: 'GiftAdressSubmit',
ProductCatalog: 'Laptop Computer',
ProductName: 'MacBook Pro',
ProductPrice: 123.45
})