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

@wise-group/tracking-jssdk

v1.0.7

Published

前端埋点sdk

Downloads

424

Readme

快速入门

$ npm i @wise-group/tracking-jssdk

引用SDK

// 在入口文件
// 小程序原生开发 app.js
const wTracker = require('@wise-group/tracking-jssdk')

// 第三方框架,如uniapp
// src/main.js
import wTracker from "@wise-group/tracking-jssdk";

初始化SDK

小程序原生

// app.js
const wTracker = require('@wise-group/tracking-jssdk')
wTracker.init({
  apiUrl: 'xxx'
})

// 针对小程序端,需要将apiUrl的域名加入小程序的Request合法域名中
App({
  ...
})

Uniapp

vue2

// src/main.js
...
wTracker.init({
  apiUrl: 'xxx',
  framework: {
    uni: Vue
  }
})
...

vue3

// src/main.js
export function createApp() {
  ...
  // const app = xxxx;
  wTracker.init({
    apiUrl: 'xxx',
    framework: {
      uni: app
    }
  });
  // return xxxx
  ...
}

方法

init(Object)

初始化SDK

参数 Object

| 字段 | 必填 | 类型 | 默认值 | 说明 | |---------------|:--:|---------|-------|-------------------------------------------------------------------------------| | apiUrl | Y | string | null | 服务端接口域名 针对小程序端,需要将apiUrl的域名加入小程序的Request合法域名中 | | appId | N | string | - | 小程序AppId | | agentId | N | string | - | 企微应用 agentid | | debug | N | boolean | false | debug模式 | | platform | N | string | - | 当前平台,默认系统会自动判断如有特殊情况可手动指定平台;可选值:mp-wx | web | | manual | N | boolean | false | 是否全手动提交默认为false,sdk会自动上报程序和页面级的进入 离开 行为 | | framework | N | Object | - | 框架信息 | | framework.uni | N | - | | uni实例(如果使用uni app框架则必填,否则无法自动抓取页面访问行为) 使用方法 |

track(action, param, eventCode)

事件上报

参数

| 字段 | 必填 | 类型 | 说明 | |-----------|:--:|--------|----------------------------------------------------------------------------------------------------------| | action | Y | string | 上报行为: launch: 应用启动 enter: 进入页面 leave: 离开页面 click: 点击 ${actionName}: 自定义行为名称 | | param | N | object | 附加参数,格式 {key: value} | | eventCode | N | string | eventCode |

insert(Object)

追加字段

部分字段在初始化时无法获取,例如用户的unionId,因此加入数据插入机制,在获取后进行补偿插入

参数

| 字段 | 必填 | 类型 | 说明 | |-------------------|:--:|--------|--------------| | unionId | N | string | 用户uid | | openId | N | string | 用户oid | | agentId | N | string | 企微应用 agentid | | wechatWorkUserId | N | string | 企微用户id | | wechatWorkEUserId | N | string | 企微外部联系人id |