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

datahunter-sdk

v1.1.1

Published

- 页面PV自动上报 - 页面关闭(unload)时暂存上报数据。下次打开时自动上报页面关闭数据,随后清除。 - 增加`runtime_id`。当用户在某一浏览器中,打开同一地址多个tab页面时,`runtime_id`会不同。此字段可区分用户不同浏览进程的行为的跟踪,防止多浏览进程交叉导致行为数据混淆。

Downloads

26

Readme

前端埋点SDK

版本更新记录

v1.1

  • 页面PV自动上报
  • 页面关闭(unload)时暂存上报数据。下次打开时自动上报页面关闭数据,随后清除。
  • 增加runtime_id。当用户在某一浏览器中,打开同一地址多个tab页面时,runtime_id会不同。此字段可区分用户不同浏览进程的行为的跟踪,防止多浏览进程交叉导致行为数据混淆。

v1.1.1

  • 增加hashchange事件自动上报

发送文档结构

{
    distinct_id: '',
    type: '',
    event: '',
    browser: {
        width: 0,
        height: 0,
        version: '',
    },
    uri: {
        url: '',
        path: '',
        params: {},
        preventPath: '',
    },
    user: {
        user_id: '',
        login_time: '',
        loginOut_time: ''
    },
    properties: {

    }
}

接口

init

初始化埋点环境。该命令在SDK植入(浏览器端)时自动运行,无需单独执行。

| 条目 | 说明 | | ---- | :----: | | 调用 | pulsars.init() | | 参数 | 无 |

项目src下新建文件夹sdk

    <div dh-handle="test">test</div>
    import Ds from 'dh-sdk';
    // 在实例化之前添加方法 此方法与html关联
    // 参数1与html属性dh-handle相对应 被点击时会上报数据
    Ds.use('test', (track, obj)=> { 
      track('$webClick', {
        step: 1,
        ...obj
      })
    })
    export const ds = new Ds();
    ds.login('user_id') // 在登录的地方设置
    export const dsMethods = {
        '/api/test': ({count}) => {
            ds.track('事件名称', {count})
        },
        '/api/test1': ({count}) => {
            ds.track('事件名称', {count})
        },
    }

asyncRequest文件夹下的axios

    import {dsMethods} from '@/sdk';
    const result = (response, msg, url) => {
      return new Promise((resolve, reject) => {
        response
          .then(res => {
            const errMsg = errorCode[res.data.code] || res.data.msg;
            switch (Number(res.data.code)) {
              case 200:
                msg && message.success(msg)
                resolve(res.data.msg)
                dsMethods[url] && dsMethods[url](res.data.msg)
                break;
              default:
                // message.error(errMsg);
                reject({
                  ...res.data,
                  msg: errMsg
                })
                break;
            }
          })
          .catch(err => {
            console.log('network err')
          })
      })
    }