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

@aistarfish/event-mini

v0.3.0

Published

海心全平台埋点SDK-小程序

Downloads

27

Readme

海心全平台埋点SDK-小程序

介绍

基于 Taro开发,为公司内部小程序项目提供独立的打点SDK。

安装

npm install @aistarfish/event-mini / yarn add @aistarfish/event-mini

使用

1.事件ID获取

具体获取参照 https://shimo.im/sheets/uhbR1dP8Pb0Tzno4/H4iy7,获取过程有任何问题,可直接联系索隆

2.SDK提供了onEventonPageStartonPageEnd三个打点方法,分别用于事件打点、页面统计。

  /**
   * 事件打点
   * @param  eventId 事件id
   * @param  params 携带参数
   */
  onEvent(eventId = "", params = {}) 

  /**
   * 页面可见的时候调用onPageStart
   */
  onPageStart(eventId) 
  /**
   * 页面不可见的时候调用onPageEnd
   */
  onPageEnd(eventId, params)

页面统计是在页面可见不可见时调用,在页面的生命周期方法中直接调用。

3.在0.0.7+版本中新增HOC方式进行页面打点。

  @PageEvent(PageEvent.Ruguoai.pageShow)
  export default class extends Component {
    ...
    //若需要设置页面额外参数,则重写此方法,返回参数对象。
    //若不需要则忽略
    setEventParams(){
      return { id: "hxjk" };
    }
    ...
  }

扩展

1.事件统计的参数会默认携带eventDateuserAgentuserId

userId用做统计当前事件的UV。若不需要统计UV则跳过。 需要手动进行设置setUserId,只需设置一次。若不进行设置,则需要开发人员放入额外参数中。

  /**
   * 存入userId
   * @param {} userId
   */
  setUserId(userId)

2.为了避免线下测试产生脏数据,SDK中提供线下线上两个域名进行打点。

生产:https://gw.aistarfish.com/api/log/upload
测试:https://gateway-d9200.aistarfish.net/api/log/upload

SDK中默认设置isDebug=true为测试环境,发布生产环境,需手动修改isDebug=false,线上需要真机调试。

/**
 * 设置打点开发环境
 * @param {*} b 
 */
 setIsDebug(isDebug)