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

fs-sls-tracker

v2.0.1

Published

## 使用

Downloads

5

Readme

FsSlsTracker 阿里云日志统计工具

使用

安装

npm install fs-sls-tracker --save

demo

import FsSlsTracker from 'fs-sls-tracker'
// 固定阿里云日志参数
const OPTS = {
  host: '', // 所在地域的服务入口。例如cn-hangzhou.log.aliyuncs.com
  project: '', // Project名称。
  logstore: '', // Logstore名称。
  time: 10, // 发送日志的时间间隔,默认是10秒。
  count: 10 // 发送日志的数量大小,默认是10条。
}
// 日志统计公共参数
let param = {
  userName: '',
  userId: '',
  userAgent: ''
}
const slsTracker= new FsSlsTracker(OPTS, param)
// 测试事件点击
slsTracker.trackerClick('npm包测试', 'test_log')
// 测试打开新页面
slsTracker.trackerOpenPage('npm包测试打开新页面', 'test_open_page')
// 测试event
slsTracker.trackerEvent('npm包测试evet', 'test_event')
// 追踪记录原始日志,用于统计请求参数,请求返回等日志信息
slsTracker.trackerLog({accessToken: '1111'})

/**
 * @function 获取自定义上报对象
 */
 function getCustomReport () {
  let param = {
    userAgent: '测试数据',
    storeId: localStorage.getItem('storeId')
  }
  return param
}
setTimeout(() => {
  localStorage.setItem('storeId', '123456')
}, 5000);
// 也可以动态传方法,更新公共参数
// const xlsxLog = new FsSlsTracker(OPTS, {
//   data() { // 非必填
//     return {
//       AppId: `fs-web-project`,
//       ...getCustomReport()
//     }
//   }
// })

配置项

  • 阿里云日志基础字段

    • host, 所在地域的服务入口。例如cn-hangzhou.log.aliyuncs.com
    • project,Project名称
    • logstore Logstore名称。
    • time 发送日志的时间间隔,默认是10秒。
    • count 发送日志的数量大小,默认是10条。
  • 公共参数,传到阿里云的公共参数,例如userName,userId等,

  • 四个统计事件参数

| 参数名称 | 类型 | 是否必填 | 描述 | 默认值 | | ---- | ---- | ---- | ---- | ---- | | category | string| 必填 | 类别, 页面名称标识或功能标识(统一中文命名) | | | seed | string | 必填 | 埋点Id,埋点的英文ID,由需求提交者定义,例如 运营广告位-点击 promotion_ops_click | | | ext4 | string | 选填 | 其他json字符串字段 | |

方法