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

burying-point-rice

v1.1.1

Published

为微信原生小程序开发的埋点系统

Downloads

1

Readme

burying-point-rice

介绍

小程序埋点系统,实例化后可以通过传入 appid 和接口地址进行数据统计,电脑上使用可能会与实机有差异,一切以真机为准 这里可以联系我的v,提供源码进行修改:rice_706 说一下项目内都是怎么样的,具体事件

1.页面会记录首次启动小程序的时间($ae_app_open)

2.页面从前台进入会记录时间($ae_app_start), 离开进入后台挂载会记录此次运行时常($ae_app_terminate)

3.当前页面浏览时常,重写了 onshow,onhide,onunload,静默记录($ae_appview_screen)

4.提供 setuseInfo 设置用户信息($identify)

5.每次提交数据中会携带系统信息 : 屏幕宽、高,系统版本,小程序版本,设备型号,品牌,是否 wifi,设备 id(uuid 生成)

6.元素曝光($show_event),元素超过一半后,并且暴露时间超过 2s 进行记录,传入元素 id 即可

7.自定义事件:trackEvents 有需求可以直接用这个,实现自定义的事件

该项目会启动后会有一个唯一id进行本次整体记录,归纳为一次使用的记录,每50条进行一次上报,单次50条含以内会有一次唯一id进行记录,方便后台统计为一次

小程序切入后台后会进行1次上报,到达50条后会进行1次上报,每隔60s会进行一次数据的上报

如有需要进行源码修改即可

软件架构

javascript uuid wxmp-rsa rollup

安装教程

装完记得构建😧

npm install burying-point-rice

实现内容

本项目实现了一些静默事件,切换前后台记录事件,启动事件,页面时长浏览记录,元素曝光度等... 具体请看源码部分,这里依旧提供自定义事件,通过trackEvents发送即可

会记录浏览时长的自定义事件可以使用trackTime,trackTimeEnd

使用说明

app.js 引入,实例化并挂载微信 实例化传入后台创建的 appid,和上报的后台地址

screenTime: 页面浏览超过n秒后开始记录,默认10s

import buryingPonit from "burying-point-rice";
let base = {
  key: "",
  baseUrl: "",
  screenTime: 5
};
wx.byr = new buryingPonit(base);
App({});

页面 js 内调用方法

page({
  onShow() {
    // 开始记录事件时间,后期可能修改为对象记录,为了实现同时进行多个事件记录
    wx.byr.trackTime();
  },
  onHide() {
    wx.byr.trackTimeEnd({
      event: "",
      last_page_code: "",
      data1: "",
      data2: "",
      ...val,
    });
  },
  handleTap() {
    wx.byr.setUserInfo();

    wx.byr.trackEvents({
      event: "",
      data2: "",
      ...val,
    });
  },
});

项目中的一些方法使用

自定义浏览事件(这里会静默记录此次事件时常)

| 事件 | 参数 | | ------------ | ------------------------------------------ | | trackTime | 无 | | trackTimeEnd | object 对象(event:事件名 other:其他参数) |

自定义点击事件

| 事件 | 参数 | | ----------- | ------------------------------------------ | | trackEvents | object 对象(event:事件名 other:其他参数) |

设置用户信息/distinct_id

| 事件 | 参数 | | ----------- | ----------- | | setUserInfo | distinct_id |

元素曝光度

| 事件 | 参数 | | --------------- | ------------------------------------------------------------ | | elementExposure | object对象:rate:元素暴露比例0-1 duration:停留时长,默认2s ids:数组,元素唯一id不用传# event:事件名,这边提供了默认的,可以不用) |