@pluve/umeng-plus-h5
v0.0.6
Published
友盟统计h5工具
Downloads
3
Maintainers
Keywords
Readme
umeng-aplus-h5
友盟 H5 场景统计 sdk 封装。友盟开发者文档
Usage
初始化
import { init } from '@pluve/umeng-plus-h5';
const appId = 'xxx';
const debug = true;
const userId = 'userId';
const idType = 'idType';
/**
* @description 初始化
* @author Dadange(Huangzhen)
* @date 2022-06-21
* @param {string} appId 对应友盟上的应用id
* @param {boolean} [debug=false]
* @param {string} [userId]
* @param {string} [idType]
*/
init(appId, debug, userId, idType);
关闭自动 pv
import { blockPVAutoReport } from '@pluve/umeng-plus-h5';
/**
* @description 关闭自动pv
* @author Dadange(Huangzhen)
* @date 2022-06-21
*/
blockPVAutoReport();
启动自动 pv
import { enablePVAutoReport } from '@pluve/umeng-plus-h5';
/**
* @description 启动自动pv
* @author Dadange(Huangzhen)
* @date 2022-06-21
*/
enablePVAutoReport();
手动发送 PV
import { sendPV } from '@pluve/umeng-plus-h5';
/**
* @description 手动发送PV
* @author Dadange(Huangzhen)
* @date 2022-06-21
*/
sendPV();
发送事件
import { sendEvent } from '@pluve/umeng-plus-h5';
/**
* @description 发送事件
* @author Dadange(Huangzhen)
* @date 2022-06-21
* @param {string} eventCode
* @param {string} eventType
* @param {(Map<string, number | string | boolean>)} [eventParams]
*/
const eventCode = 'addCart';
const eventType = 'click';
const params = {
goodsCode: 'xxx',
goodsQuantity = 5,
};
sendEvent(eventCode, eventType, params);
抓取页面异常
import { catchError } from '@pluve/umeng-plus-h5';
/**
* @description 抓取页面异常
* @author Dadange(Huangzhen)
* @date 2022-06-21
*/
catchError();