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 🙏

© 2026 – Pkg Stats / Ryan Hefner

erwan-fe-stat-wxmini

v2.1.0-beta.0

Published

微信小程序全埋点SDK

Readme

erwan-fe-stat-wxmini

小程序埋点通用方案,支持加载、点击、自定义事件

域名地址

  • 测试:https://testctai.qn76.cn
  • 线上:https://cta.feierlaiedu.cn

使用方式

Installing

    var erwan_stat = require('./utils/stat'); // 接入自定义
    erwan_stat.init('qiniu','miniprogram','test');
    wx.erwan_stat = erwan_stat;

Usage

    wx.erwan_stat.setOpenId('openId'); // 设置openId

    wx.erwan_stat.customEvent('CourseDetailShow',{id: '435477844051649289',title: '微课堂微课堂'});  //自定义事件上报

API

wx.erwan_stat.init(project:string,sub_project:string,env:str,miniAppId:string) 初始化sdk

  • project: 必传 品牌
  • sub_project: 必传 子业务线
  • env: 必传 环境变量 test:测试环境 prod:生产环境 默认生产
  • miniAppId: 非必传,小程序appid
erwan_stat.init('qiniu','miniprogram','test','wxf97ce6e6de85aede');

wx.erwan_stat.setOpenId(openId:string) 设置openId

wx.erwan_stat.setOpenId('openid');

wx.erwan_stat.setUnionId(unionId:string) 设置unionId

wx.erwan_stat.setUnionId('unionId');

wx.erwan_stat.setMiniAppId(miniAppId:string) 设置小程序appId

wx.erwan_stat.setMiniAppId('miniAppId');

wx.erwan_stat.setUserId(userId:string) 设置userId

wx.erwan_stat.setUserId('userId');

wx.erwan_stat.setAbPropsData(ab_props:[object:{[string]:[number|stringt]}) 存储ab测相关标识数据

wx.erwan_stat.setAbPropsData({test_id:"1",area_id:"2",record_id:"3"});

wx.erwan_stat.removeAbPropsData() 清除ab测相关标识数据

wx.erwan_stat.removeAbPropsData();

wx.erwan_stat.customEvent(name:[string],params:[object:{[string]:[number|stringt]}]) 自定义事件上报

  • name: 必传,自定义事件名称
  • params: 非必传,自定义上传参数,注:属性类型 numberstring

wx.erwan_stat.customEvent(name:[string],detail:[string],params:[object:{[string]:[number|stringt]}]) 自定义事件上报

  • name: 必传,自定义事件名称
  • detail: 非必传,自定义事件二级名称
  • params: 非必传,自定义上传参数,注:属性类型 numberstring

wx.erwan_stat.customEvent(options: {name: [string], detail: [string],params: {[key]: [string|number]} }) 自定义事件上报

  • option: 必传
    • name: 必传,自定义事件名称
    • detail: 非必传,自定义事件二级名称
    • params: 非必传,自定义上传参数,注:属性类型 numberstring

wx.erwan_stat.customEventEncrypt(options: {name: [string], detail: [string],params: {[key]: [string|number]},encrypt: {[key]: [string|number]} }) 自定义事件加密上报

  • option: 必传
    • name: 必传,自定义事件名称
    • detail: 必传,自定义事件二级名称
    • params: 必传,自定义上传参数,注:属性类型 numberstring
    • encrypt: 必传,自定义上传参数,注:属性类型 numberstring
// name必传,detail非必传,params非必传
wx.erwan_stat.customEvent('HomeShow');
wx.erwan_stat.customEvent('CourseDetailShow',{id: '435477844051649289',type: 1,title: '微课堂微课堂'});
wx.erwan_stat.customEvent('CourseDetailShow','CourseDetailDetail',{id: '435477844051649289',type: 1,title: '微课堂微课堂'});
wx.erwan_stat.customEvent({
    name: 'CourseDetailShow',
    detail: 'CourseDetailDetail',
    params: {id: '435477844051649289',type: 1,title: '微课堂微课堂'}
});
wx.erwan_stat.customEventEncrypt({
    name: 'CourseDetailShow',
    detail: 'CourseDetailDetail',
    params: {id: '435477844051649289',type: 1,title: '微课堂微课堂'},
    encrypt: {mobile: '14051649289',real_name: '微课堂'},
});

新版本小程序全埋点使用

import Stat from 'erwan-fe-stat-wxmini'; // 引入尔湾全埋点

- const elephantConf = {
-    elephantId:'60134450-5256-45ca-b344-7d1f0489d25d',//大象 id
-    enableAction: true, // 是否开启用户动作监听
-    enableError: true, // 是否开启错误监听
-    enableXhr: true, // 是否开启Xhr上报
-    enablePerformance: true, // 是否上报性能监控
-    xhr: {
-        includes: [], // 上报业务接口规则
-        excludes: [// 不上报的接口规则
-            'cta.feierlaiedu.com',
-            'cta.feierlaiedu.cn',
-            'testctai.qn76.cn',
-            'cta-bak.feierlaiedu.cn'
-        ] 
-    },
-};

// 初始化
wx.erwan_stat= new Stat(elephantConf);

//project:'qiniu', //品牌(业务线) 启牛/保险/讲真/伴财  必传
// sub_project:'miniprogram',// 子业务线 投放/直播/课程/APP  必传
// env:'test',//环境 必传
// miniAppId:ENV.appId,//小程序id 必传

//启动
wx.erwan_stat.init('qiniu','miniprogram','test',ENV.appId);

//登录之后传递参数
wx.erwan_stat.setOpenId(openId:string) `设置openId`
wx.erwan_stat.setUnionId(unionId:string) `设置unionId`
wx.erwan_stat.setUserId(userId:string) `设置userId`

#小程序管理后台添加请求域名白名单
'https://cta.feierlaiedu.com',
'https://cta.feierlaiedu.cn',
'https://testctai.qn76.cn',
'https://cta-bak.feierlaiedu.cn',

Build

基于rollup构建

    yarn run mini-dev # 开发环境
    yarn run mini-build # build包

项目配置

品牌: qiniu    baoxian     jiangzhen    bancai   yicai
子业务线: adserving    live   course    app    miniprogram

小程序管理后台添加请求域名白名单

'https://cta.feierlaiedu.com', 'https://cta.feierlaiedu.cn', 'https://testctai.qn76.cn', 'https://cta-bak.feierlaiedu.cn',