友盟 H5 场景统计 sdk 封装。友盟开发者文档
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);
import { blockPVAutoReport } from '@pluve/umeng-plus-h5';
/**
* @description 关闭自动pv
* @author Dadange(Huangzhen)
* @date 2022-06-21
*/
blockPVAutoReport();
import { enablePVAutoReport } from '@pluve/umeng-plus-h5';
/**
* @description 启动自动pv
* @author Dadange(Huangzhen)
* @date 2022-06-21
*/
enablePVAutoReport();
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();