@pluve/umeng-plus-h5
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

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();

/@pluve/umeng-plus-h5/

    Package Sidebar

    Install

    npm i @pluve/umeng-plus-h5

    Weekly Downloads

    2

    Version

    0.0.6

    License

    ISC

    Unpacked Size

    11.1 kB

    Total Files

    5

    Last publish

    Collaborators

    • fuqiting
    • zhaoyajie
    • annan1220
    • pengfeng365
    • plutolove
    • vdfor
    • ddg-dany
    • yangwend
    • yaqin8023
    • damonchen
    • lee2545
    • abel0222
    • stevenluo
    • xiongyan
    • deng_cheng