1 Star 4 Fork 1

Jerry K / beeweb-logger

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

@beeweb/logger

一款用于收集页面 PV/UV、用户行为和交互的轻量级前端埋点SDK

安装

$ npm install --save @beeweb/logger
# or
$ yarn add @beeweb/logger

使用

import { mount, listener } from '@beeweb/logger';

// 需要挂在到项目实例中
// 默认集成Page级别事件监听
mount()

// 监听埋点回调
listener(function(response) {...})
/* listener response
{
    address: {xxx},
    kernel: "chrome 92.0.4515.131",
    os: "Windows",
    createTime: "2021-07-17 19:46:01"
    eventType: "page"
    pageStatus: "enter"
    stateType: "load"
    statement: {xxx},
    stayTime: 0,
    traceId: xxx,
    url: "http://127.0.0.1:5500/packages/logger/example/index.html"
}
*/

mount 函数

可接收一个 options 对象

Option Type Required Description
traceId String false 链路 ID
statement Object false 声明
mapURI String false 百度地图定位
serverURL String false 后端接口请求地址
encryptionFunc Function | 'useDefault' false Function: 接收一个加密函数,对监听到的参数做处理
'useDefault': 默认使用Base64加密

listener 函数

事件触发回调函数

import { listener, handleClick, handleCustom, mountPageEvent } from '@beeweb/logger';

// 挂载页面监听
mountPageEvent();

// 触发点击事件函数
handleClick(...args);

// 自定义事件函数
handleCustom(...args)

// 监听埋点回调
listener(function(response) {...})

mountPageEvent 函数

挂载页面级别监听

监听类别: 'load' | 'popstate' | 'pushState' | 'replaceState' | 'unload'

handleClick 函数

接收一个任意类型的参数

handleCustom 函数

接收一个任意类型的参数

此功能用于辨识定制化需求触发器

MIT License Copyright (c) 2021 Gj Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

💬 一款用于收集页面 PV/UV、用户行为和交互的轻量级前端埋点SDK 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/g0ngjie/beeweb-logger.git
git@gitee.com:g0ngjie/beeweb-logger.git
g0ngjie
beeweb-logger
beeweb-logger
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891