Skip to content

SDK 文档

整体思路:

  1. 监听路由/页面变化
  2. 定时器3s请求一次进行请求
  3. 上报方式为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_idapp_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-