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

miniapp-tracker-sdk

v0.0.10

Published

npm install @tklc/miniapp-tracker-sdk --registry=http://10.0.0.122:7001

Downloads

5

Readme

install

npm install @tklc/miniapp-tracker-sdk --registry=http://10.0.0.122:7001

app.js

import Tracker from '@tklc/miniapp-tracker-sdk'
App({
  onLaunch(options){
   Tracker.App.init({
     appId:'2019022763399300',// 区别不同小程序,可用小程序自己的appId
     server:['http://10.0.0.122:8088/event/upload'],
     version:'1.0',//更新小程序请更新此版本
     lauchOpts:options,
     appName:"苏州小程序",
     //bizScenario:‘xxxxx’, 不传入此值会去自动从options取渠道字段
     stat_auto_click:true,//自动埋点
     mtrDebug:false
   },this)

....
  }

.....

page:

const app = getApp();

Page({
  onLoad() {
    app.Tracker.Page.init()



  },

userId

 app.getUserInfo().then(
      user => {
        this.setData({
          user,
        });
          app.Tracker.setUserId(user.userId)
      },
      () => {
        // 获取用户信息失败
      }
    );

API

页面自动埋点

埋点说明

自动点击事件埋点请初始化时设置 stat_auto_click = true
页面加载埋点自动,需每个 page init
onLoad() {
app.Tracker.Page.init()
....
组件里面:
didMount() {
getApp().Tracker.Component.init(this)
....

点击埋点 xml 配置

<view class="service-item" a:for="{{my_service_icon.ele_icons}}" >
                <image class="icon-logo" src="{{item.icon_img}}" mode="widthFix"
                data-seed="埋点seed名称"
                data-group="卡面" data-index="{{index}}"
                data-obj="{{item}}"
                onTap="handleIconClick"/>
                <text class="text">{{item.icon_name}}</text>
            </view>

data-obj 里要带 icon_name ,url_path,url_type,url_data,url_remark, 点击事件会传过去

注意事项: 需要配置 data-group(板块) 和 data-index(位置, 有 a:for 的才有) 如 data-group="卡面" data-index="{{index}}"

page js 方法

const app = getApp()
createPage({
....
,
  async onLoad() {
    app.Tracker.Page.init() //埋点init 每个page都需要,自动埋页面onShow事件
    ,
  handleIconClick(e){
    app.handleIconClick(e)
  },
  ....

app.js 统一封装

 handleIconClick(e) {
      console.log('handleClick', e.currentTarget.dataset)

      this.handleNavigate(obj)
    },
    async handleNavigate(options) { //跳转
 ....
    }

点击事件手动埋点
如 app.Tracker.click('seedName1',{a:1,b:2})
错误日志上送:
app.Tracker.err('tag','error msg')
一般日志上送
app.Tracker.log('test Log')
上送有数值的埋点事件
app.Tracker.calc('seedNameCalc',10)

const app = getApp();

    app.Tracker.log('test Log')
    app.Tracker.calc('seedNameCalc',10)
    app.Tracker.err('tag','error msg')
    app.Tracker.click('seedName1',{a:1,b:2})
    app.Tracker.setUserId(user)