@bud-fe/trace-utils
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

@bud-fe/trace-utils

npm

小程序前端埋点工具库,目前采用 aplus 埋点


安装

# 如果使用hooks,需要安装react
$ npm i react@^17.0.0

$ npm i --save @bud-fe/trace-utils
# or
$ yarn add @bud-fe/trace-utils

🔨 使用

初始化

import { initMiniAplus, setBlockHold, setDebug, setStartHold, setUserId } from '@bud-fe/trace-utils';

initMiniAplus({
  appKey: 'uxcbdlipr4qhykcdr64aauao',
  appVersion: '0.0.1',
  debug: true,
});
setBlockHold(); // 暂停上报
setUserId('111111111', { BU_TYPE: 'BU_SE' });  // 登录后的用户
setStartHold(); // 开启上报

页面使用

import { recordCLK, usePageTrace } from '@bud-fe/trace-utils';

##自定义PV
usePageTrace({
    path: '/pages/index/index',
    eventName: '1111',
    extra: { xxx: 333, yyy: 222 },
  });

##点击事件
recordCLK({
    recordCode: '1111',
    pageName: '3333',
  });

##曝光时间
recordEXP({
  recordCode: '1111',
  pageName: '3333',
})

##其他事件埋点
recordOTHER({
  recordCode: '1111',
  pageName: '3333',
})

Readme

Keywords

Package Sidebar

Install

npm i @bud-fe/trace-utils

Weekly Downloads

1

Version

0.0.7

License

MIT

Unpacked Size

324 kB

Total Files

18

Last publish

Collaborators

  • wind226
  • angela.lu
  • jiangshengrong
  • hailongsun
  • wujd
  • sandyliu
  • macrodu
  • luseng
  • kinneyyan
  • l-z