1.3.7 • Published 5 months ago

dyz_link v1.3.7

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

目的

智链引擎事件上报工具方法

安装

npm install dyz_link

//或
yarn add dyz_link

参数说明

init方法参数

参数说明类型必需默认值
assessToken安全密钥String
assessSecretassess secretString
projectId项目 idString
uid用户 idString | Number
jump上报成功是否自动跳转Booleantrue

上报自定义事件参数

参数说明类型必需默认值
event事件名称String
customData自定义事件参数any

方法说明

方法名说明类型参数返回值
initSDK 初始化Function(init 方法参数,()=>{})Promise
setIdentity设置用户(如有用户体系)Function(用户 id,()=>{})Promise
install上报安装事件Function((data)=>{})Promise
open上报打开事件Function((data)=>{})Promise
customEvent上报自定义事件Function(自定义事件参数,(data)=>{})Promise

使用

//1.引入
import branch from 'dyz_link';


//2.初始化(必须先初始化后再调用上报方法)
const params = {
  "assessToken": "your assess token",
  "assessSecret": "your assess secret",
  "projectId": "your projectId"
}

branch.init(params).then(() => {
  console.log("初始化成功、可调用上报方法")
}).catch(error => {
  console.log("初始化失败", error)
})  

//或
branch.init(params,(data) => {
  if(data.state == "success"){
    console.log("初始化成功、可调用上报方法")
  }else{
    console.log("初始化失败", data.msg)
  }
})

//设置用户(如有用户体系)
branch.setIdentity("userId").then(()=>{
   console.log("用户成功")
})


//3.调用

//上报安装事件
branch.install().then((data) => {
  console.log("上报成功", data)
}).catch(error => {
   console.log("上报失败", error)
})  

//上报打开事件  
branch.open().then((data) => {
  console.log("上报成功", data)
}).catch(error => {
  console.log("上报失败", error)
})  

//上报自定义事件  
const params = {
  "event": "Event name",
  "customData": [{"key": "自定义事件参数键","value": "自定义事件参数值"}]
}
branch.customEvent(params).then((data) => {
  console.log("上报成功", data)
}).catch(error => {
  console.log("上报失败", error)
})  
1.3.7

5 months ago

1.3.6

5 months ago

1.3.5

5 months ago

1.3.3

6 months ago

1.3.2

6 months ago

1.3.1

6 months ago

1.3.0

7 months ago

1.2.9

7 months ago

1.2.8

7 months ago

1.2.7

7 months ago

1.2.6

7 months ago

1.2.5

7 months ago

1.2.4

7 months ago

1.2.3

7 months ago

1.2.2

7 months ago

1.2.1

7 months ago

1.2.0

7 months ago

1.1.9

7 months ago

1.1.8

7 months ago

1.1.7

7 months ago

1.1.6

7 months ago

1.1.5

7 months ago

1.1.4

7 months ago

1.1.3

7 months ago

1.1.2

7 months ago

1.1.1

7 months ago

1.1.0

7 months ago

1.0.9

7 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago