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

mql-web-report

v0.0.4

Published

大数据上报

Downloads

2

Readme

koznak-report

大数据上报

安装

npm i mql-web-report -S

示例 🌰

import ReportSdk from "mql-web-report";
const reportSdk = ReportSdk.getReportSdk("appKey", {
  userId: "",
  version: "",
  tocken: "",
  deviceId: "",
  carrier: "",
});
// 心跳事件
reportSdk.reportHeart();
// 浏览事件
reportSdk.reportPage({
  pageId: "",
  pageName: "",
  eventId: "",
  eventType: "",
});

参数

|字段|说明|类型|是否必穿、默认值| |:---:|:---:|:--:|:--:| | appKey |大数据唯一标识|string|✅| |userInfo|用户信息|UserInfo|✅| |env|环境| "test | "product" | 可为空、默认"test"测试环境|

UserInfo

|字段|说明|类型| |:---:|:---:|:--:| |userId|唯一标识|string |tocken|登陆令牌|string |version|版本号|string |deviceId|设备ID|string |carrier|运营商|"Mobile" | "Unicom" | "Telecom" |""

方法

reportHeart 🔧

心跳事件

代码演示

import ReportSdk from "mql-web-report";
const reportSdk = ReportSdk.getReportSdk("appKey", {
  userId: "",
  version: "",
  tocken: "",
  deviceId: "",
  carrier: "",
});
reportSdk.reportHeart();

返回类型

Promise<void>

reportPage 🔧

浏览事件

代码演示

import ReportSdk from "mql-web-report";
const reportSdk = ReportSdk.getReportSdk("appKey", {
  userId: "",
  version: "",
  tocken: "",
  deviceId: "",
  carrier: "",
});
reportSdk.reportPage({
  pageId: "",
  pageName: "",
  eventId: "",
  eventType: "",
});

参数说明

ReportPageP

|字段|说明|类型|是否比传 |:---:|:---:|:--:|:--:| | pageId |页面ID|string|✅ | pageName |页面名称|string|✅ | eventId |事件ID|string|✅ | eventType |事件类型|string|✅ |dataMap|自定义数据|{[key:string]:any}|❌

返回类型

Promise<void>

reportClick 🔧

点击事件

代码演示

import ReportSdk from "mql-web-report";
const reportSdk = ReportSdk.getReportSdk("appKey", {
  userId: "",
  version: "",
  tocken: "",
  deviceId: "",
  carrier: "",
});
reportSdk.reportClick({
  pageId,
  targetId,
  targetName,
  targetType,
  eventId,
  eventType,
});

参数说明

ReportClickP

|字段|说明|类型|是否比传 |:---:|:---:|:--:|:--:| | pageId |页面ID|string|✅ | pageName |页面名称|string|✅ | eventId |事件ID|string|✅ | eventType |事件类型|string|✅ | targetType |目标类型|string|✅ | targetName |目标类型|string|✅ |dataMap|自定义数据|{[key:string]:any}|❌

返回类型

Promise<void>

reportExposure 🔧

曝光事件

代码演示

import ReportSdk from "mql-web-report";
const reportSdk = ReportSdk.getReportSdk("appKey", {
  userId: "",
  version: "",
  tocken: "",
  deviceId: "",
  carrier: "",
});
reportSdk.reportExposure({
  pageId,
  targetId,
  targetName,
  targetType,
  eventId,
  eventType,
});

参数说明

ReportExposureP

|字段|说明|类型|是否比传 |:---:|:---:|:--:|:--:| | pageId |页面ID|string|✅ | pageName |页面名称|string|✅ | eventId |事件ID|string|✅ | eventType |事件类型|string|✅ | targetType |目标类型|string|✅ | targetName |目标类型|string|✅ |dataMap|自定义数据|{[key:string]:any}|❌

返回类型

Promise<void>

类型定义

import type {
  Sdk,
  Env,
  ReportClickP,
  ReportExposureP,
  ReportPageP,
  DataMap,
  Target,
  Event,
  Page,
  UserInfo,
} from "mql-web-report";

开发说明

目录结构

src

开发目录

|文件名|说明| |:---:|:---:| | config.ts |配置文件 | index.ts |入口 | reportSdk.ts |大数据上报类 | tools.ts |工具库 | type.ts |类型集合

tests

测试目录

|文件名|说明| |:---:|:---:| | mock | 模拟上报数据 | unit |测试用例 | ws |webSocket监听上报结果

.husky

Git钩子相关

dist

打包文件

脚本说明

  • lint

ESlint代码语法校验、prettier代码格式校验并尝试自动修复

  • tsc

TypeScript类型校验

  • lint:commit

lint校验Git暂存区

  • patch

npm包版本升级

  • test

运行jest测试用例

  • build

打包

  • commit

git cz代码提交(用于commit信息约束)

  • 其他

CI、publish脚本用于CI发版、prepare用户Git钩子初始化