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

@shuyun-ep-team/monitor-track-web

v2.3.1

Published

数云前端监控及埋点SDK工具javascript版本

Readme

数云前端监控及埋点 SDK 工具

使用

方式一:NPM 包

# using npm
$ npm install @shuyun-ep-team/monitor-track-web -S
import Track from '@shuyun-ep-team/monitor-track-web';

const track = new Track();

window.track = track;

track.init({
  // 由监控平台后台管理系统创建项目时生成
  projectID: '123',
  reportUrl: 'http://localhost:3008/report',
  // 如果是服务端渲染的项目,spa需要设置成false
  spa: true,
  // 单应用的hash模式的项目,hash需要设置成true
  hash: true,
});

方式二:CDN 地址

<script
src=`https://crmepfe-qybcgl416.oss-cn-hangzhou.aliyuncs.com/OSS/track-sdk/v2/
index.js?timestamp=${Date.now()}`></script>

const track=new window.KylinAnalytics()
window.track=track;
track.init({
  projectID:'项目ID',
  reportUrl:'https://项目实际地址.kylin.shuyun.com/behavior-sense/event/receiver',
  enable:true,
  spa:true
});

配置项

| 配置项 | 类型 | 必填 | 默认值 | 注释 | | --------------------- | ------- | ---- | ------ | -------------------------------------------------- | | reportUrl | string | 是 | '' | 上报地址,后台地址 | | projectID | string | 是 | '' | 项目 ID | | spa | boolean | 否 | false | 是否为单页面应用,主要区别页面性能,及路由切换行为 | | hash | boolean | 否 | false | 路由是否为 hash 模式 | | enable | boolean | 否 | false | 是否开启日志收集,默认关闭 | | appid | string | 站点合并模式下必填 | - | 站点 ID,Web/H5 只要求为非空字符串,上报时转换为 _appid | | appname | string | 站点合并模式下必填 | - | 站点名称,只允许包含数字、字母、中文字符,上报时转换为 _appname | | enableSiteMerge | boolean | 否 | false | 是否启用站点合并监测模式 | | maxLength | number | 否 | 1000 | 最长上报数据长度 | | XMLHttpRequestTimeout | number | 否 | 1000 | 上报 xhr 请求超过指定时间 |

站点合并监测

track.init({
  projectID: '共享项目ID',
  reportUrl: 'https://项目实际地址.kylin.shuyun.com/behavior-sense/event/receiver',
  appid: 'h5-site-001',
  appname: '官网H5',
  enableSiteMerge: true,
  enable: true,
  spa: true,
});

启用 enableSiteMerge 后,appidappname 必填。appid 只要求是非空字符串,appname 只允许包含数字、字母、中文字符。未启用站点合并时,这两个参数为可选;传入有效值会随所有事件上报为 _appid_appname,传入无效值会 warning 并忽略。

自定义事件

track.sendCustomEvent('customOrderEvent', {
  title: '商品名称',
  price: '商品价格',
});

customOrderEvent 为不同的不同的业务埋点事件,title、price 为埋点事件对应的数据属性

用户属性事件

为了对用户进行唯一标识,提高用户行为分析的准确性,支持在用户注册或者登录时,上报用户属性。

登录时,上报登录 ID,登录 ID 可以使手机号码或者会员 ID。

注册时,上报注册信息,会员 ID、用户名等信息。

track.setUserInfo({
  email: '[email protected]',
  city: '上海',
});

电商预置事件

在用户订单提交完成时,触发提交订单事件。

track.sendOrderInfo({
  /**订单ID*/
  orderID: 'sd_12345563',
  /**订单金额*/
  totalFee: 5000,
});