sensor-tracker

1.0.1 • Public • Published

使用

根据神策官方文档你需要传递这些参数

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
})
 
 

Readme

Keywords

Package Sidebar

Install

npm i sensor-tracker

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

3.06 kB

Total Files

4

Last publish

Collaborators

  • vnues