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

longan-sdk-mini-program

v0.1.7

Published

monitor sdk support for mini-program pv uv and global event

Readme

longan-mini-program-sdk

longan-monitor-js-sdk、wx-mini-program、taro-weapp

统计 应用来源、PV信息、错误信息、细粒度埋点

版本信息

V0.1.7更新:
(1)配置信息新增cancelAutoPvList,值是路由数组
(2)增加dispatchPv方法
V0.1.4更新:
(1)修正了自定义组件 获取不到元素的问题
(2)修正了子包不触发埋点的问题

开发

npm link

npm start

发布

npm run build

npm login

npm publish

安装与引入

(1)wx-mini-program:
安装:
npm install longan-mini-program-sdk
引入:
初始化package.json
工具-构建npm包
import Longan from 'miniprogram_npm/longan-sdk-mini-program/index';
(2)Taro:
安装:
npm install longan-mini-program-sdk
引入:
import Longan from 'longan-mini-program-sdk';

使用

一、wx-mini-program
(1)全局注册(app.js)
import Longan from 'miniprogram_npm/longan-sdk-mini-program/index';
Longan.start({wx, App, Page, longanConfig, basicConfig});
其中basicCondig包含project_name、env_type必填字段,其中longanConfig为全量埋点的配置文件

basicCondig示例如下:
const basicConfig = {
  project_name: 'mini-program',
  env_type: 1,
};

(2)页面引入
    在wxml的根节点绑定事件处理 catchtap="longanCatch"
(3)设置埋点元素id='longan-[something]'
二、taro
(1)全局注册(app.js)
import Longan from 'longan-mini-program-sdk';
Longan.register({ Taro, longanConfig, project_name: 'mini-program-employment', env_type: 1 });
可选项:withRouteExtraParams: boolean;loginUser: string;
(2)页面引入
import { withLongan } from 'longan-sdk-mini-program';
装饰器,如:@withLongan(Taro)
在根节点绑定事件 onClick={this.longanCatch}
(3)设置埋点元素id='longan-[something]'
全量埋点的配置文件,示例如下:

const config = {
    'pages/index/index': {
      pageName: '首页',
      buryInfo: {
        'longan-add': '加一个',
        'longan-minus': '减一个',
        'longan-counter': '计数器',
        'longan-test': '测试',
      },
    },
    'pages/store/index': {
        pageName: '店铺',
        buryInfo: {
          'longan-store': '店铺管理',
        },
      }
};

export default config;
  
三、自定义埋点
longan.dispatch(Taro, {
  event_name: 'longan-event1',
  event_desc: '自定义埋点',
  event_type: 1,
});
其中event_type为可选,默认值为1
{ 1: '点击行为', 2: '其他类型' }
四、更新配置信息
longan.updateConfig(Taro, config);
config字段: Object