voila-tracking-sdk
v1.2.8
Published
A lightweight JavaScript SDK for analytics tracking.
Downloads
284
Maintainers
Readme
使用示例
1. 下载TrackingSDK
npm i voila-tracking-sdk
2. 引入TrackingSDK
import TrackingSDK from "voila-tracking-sdk";
3. 初始化TrackingSDK
const tracker = new TrackingSDK('https://yourserver.com/track');
4. 发送自定义事件
tracker.sendEvent(eventId,baseData, eventData);
5. 参数解析
eventId: 必传参数,打点 id
baseData: 必传参数,platform可选值为 h5、pc 、plugin、bookmark、app
eventData: 选传,业务参数
6. 点击离开页面埋点
tracker.sendEventWithBeacon(eventId,baseData, eventData);