Appearance
SDK 文档
整体思路:
- 监听路由/页面变化
- 定时器3s请求一次进行请求
- 上报方式为
new Image()
,设置图片src,发送get请求
使用
1.pv统计
ts
// 初始化 页面引入initReport
import { initReport } from "@/libs/nxh_report.module.min.js"
initReport({
apiUrl: 'https://nxh-tp5-dev.iwxapi.cn', // 接口域名
app_id: '', // app_id唯一标识
delay: '3000', // 每次上报间隔时间
})
initReport({ apiUrl: '', app_id: '', delay: '' })
参数名 | 说明 | 是否必传 | 默认值 |
---|---|---|---|
apiUrl | 接口域名(admin、源码定制、一物一码、微信助手、易企秀项目里可以不传,sdk内有预设值) | 否 | - |
app_id | app_id唯一标识 | 否 | - |
delay | 每次上报间隔时间 | 否 | 3000 |
2.事件统计
ts
// 初始化 页面引入postEvent
import { postEvent } from "@/libs/nxh_report.module.min.js"
postEvent('click_event_name', id)
postEvent('click_event_name', id)
参数 | 说明 | 是否必传 | 默认值 |
---|---|---|---|
argument[0] | 事件名,和后端同步 | 是 | - |
argument[1] | id | 否 | - |