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

xkw-miniprogram-sdk

v1.0.1

Published

将测试目录或者正式环境的目录中的index.js复制到自己的目录下, 我这里放在了/static/xkw-miniprogram-tracker-test目录下

Downloads

3

Readme

一、引入

将测试目录或者正式环境的目录中的index.js复制到自己的目录下, 我这里放在了/static/xkw-miniprogram-tracker-test目录下

在app.js中引入资源并创建埋点实例

app.js

const tracker = require('./static/xkw-miniprogram-tracker-test/index')
tracker.init({
    name: 'tracker', // 在其他页面访问tracker对象使用的标识;可以通过getApp().tracker获取这个对象
    product: '学科网'  // 必填字段;学科网/组卷网/e备课/AI研修等
})

init()方法需要接受两个配置项,一个是name,是埋点实例的标识符,在其他页面需要使用getApp()[标识符]获取埋点实例;另一个是product表示产品,product字段会拼接到发送的数据对象中

二、传递数据

1、普通数据

在app.js中可以直接使用tracker对象,在其他组件中,需要使用getApp()['tracker]拿到tracker对象

方式一:(key, value)形式,一次只传入一个参数

tracker.send('$user_id', 'xy05867')  // 添加key为$user_id,value为xy05867的数据

方式二:对象形式,可以批量添加

tracker.send({
    $user_id: 'xy05867',
    $openid: 'AAAA-BBBB-CCCC-DDDD'
})

key值一致的数据会进行覆盖

发送的数据key要以$开始,以示区分,key是产品列举出来的数据中的key,如果要发送其他数据,需要使用扩展字段的形式发送

2、自定义事件$custom

含义:自定义事件,json字符串格式,至少包含event_name属性

举例:

sensors.sendCustom('{"event_name":"user_identity_confirm_popup","selected_identity":"老师"}')

发送数据:

接入端调用sendCustom()方法的时候,会立即发送这条数据,并且数据中只有$custom一个属性

{
    $custom: {
        event_name: "user_identity_confirm_popup",
        selected_identity: "老师"
    }
}