npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

weblogger25

v3.0.49

Published

是基于浏览器环境的

Downloads

5

Readme

web-logger

web-logger 整体采用插件化的方式, 支持按需加载,支持自定义插件. 内部采用fetch等原生方案保证埋点包整体大小.简化了加签验签方案、最大程度的减少初始化复杂度


快速开始

web-logger 开箱即用,并内置插件fetchPlugin, detectRouter,detectDevice,detectionSignal,jsMobileBridge,getKey,vConsole

  • 通过npm方式安装

    # 需要安装最新的3.0的版本
    # 安装指定版本 
    # npm install [email protected]
    npm install web-logger
  • 代码中的运用

      import { detectDevice, detectRouter, fetchPlugin, WebLogger,detectionSignal, jsMobileBridge,getKey, vConsole} from 'web-logger'
    
      const weblogger = new WebLogger({
        // 具体字段意思可查询文档下面内容
        data: {
          // 
          // vin: '',
          // 用户类型
          user_type: '',
          user_id: '',
          open_id: '',
          p_name: '',
          p_package: '',
          p_id: '',
          // 当是webpc系统时需要传入'web',
          // device_type: '',
          // 当是webpc系统时需要传入'web',
          // form: ''
          // 当是history模式时需要添加这个参数
          //routerMode: 'history',
        },
        plugins: [
          // 数据加密
          getKey(),
          // 数据上报
          fetchPlugin(),
          // 根据ip地质获取当前的一些网络信息和经纬度
          detectionSignal(),
          // 获取设备信息
          detectDevice(),
          // 本地打印上报日志
          {
            name:'console',
            apply(next, context) {
              context.$on('dataPush', (data) => {
                console.log('===================data', data)
              })
              next();
            }
          },
          // 可选择,当是app应用h5时需要增加这个插件
          jsMobileBridge(),
          vConsole({ maxLogNumber: 1000 }),
          // 提交前可以修改上报数据
          {
            name: 'modify-data',
            apply(next){
              next()
            },
            beforeSubmit(context, $event){
              console.log(context, $event)
    
            }
          }
          // 路由监听包括初始化路由监听,事件的监听
          detectRouter(),
            
        ]
      })
    
      //vue中
      Vue.prototype.$weblogger = weblogger
    
      weblogger.click({
        arg: {
          
        },
        ctrl_name: '',
          
    
      })
    
      weblogger.custom({
        event_name: ''
      })
    

插件介绍

  • fetchPlugin 通过fetch方案上报大数据封装数据

  • detectRouter 动态监测router跳转自动上报数据

  • detectionSignal 可获取当前网络运营商、ip等信息

  • detectDevice 根据navigation 监测当前设备、浏览器等相关信息

  • jsMobileBridge 当是app应用h5时需要增加这个插件

  • getKey 数据加密(必备)

  • vConsole 内置移动端调试插件,自动检测环境

后续会增加更多的有意思好玩的插件


埋点文档

此埋点后续专门服务于h5、小程序、webpc等相关技术,埋点相关字段可参照 https://beantechs.feishu.cn/sheets/shtcnnkybQ2e6JYNPDPz1GAniv0?sheet=2uXVpO&nd=3


QA常见问题

  1. 问题: 安装web-logger过程中出现404

    答: 再根目录下创建一个 .npmrc 文件并填写内容 registry = http://repo.btpoc.com/repository/npm-public/

  2. 问题:安装web-logger失败

    答: 尝试删除 lock 文件和 node_modules 文件,重新安装一遍依赖