0.0.7 • Published 2 years ago

@bud-fe/trace-utils v0.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@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',
})
0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago