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

anchor-point-statistics

v0.6.9

Published

全平台用户行为统计,需要配合后端

Downloads

27

Readme

anchor-point-statistics

使用TypeScript实现全平台用户行为统计,需要配合后端

安装

使用npm进行安装

npm install anchor-point-statistics

使用yarn进行安装

yarn add anchor-point-statistics

快速上手

在组件中引入:

import APS from 'anchor-point-statistics/dist/anchor-point-statistics.es5'

api

打开应用

const aps = new APS

aps.openApp({ 
  user_id: '' // 用户id
})

关闭应用

const aps = new APS

aps.closeApp({ 
  user_id: '' // 用户id
})

收藏商品

const aps = new APS

aps.collect({ 
  user_id: '', // 用户id
  product_id: '', // 商品id
  product_name: '' // 商品名称
})

取消收藏商品

const aps = new APS

aps.unCollect({ 
  user_id: '', // 用户id
  product_id: '', // 商品id
  product_name: '' // 商品名称
})

搜索商品

const aps = new APS

aps.unCollect({ 
  user_id: '', // 用户id
  keyword: '' // 搜索内容
})

浏览商品详情

const aps = new APS

aps.browse({
  user_id: '', // 用户id
  product_id: '', // 商品id
  product_name: '' // 商品名称
})

浏览商品列表

const aps = new APS

aps.browse({
  user_id: '', // 用户id
  product_name: 'name1/ name2/ name3' // 名称以/进行分割
})

浏览商品列表时间

浏览商品列表时间的实现方式是进入页面时调用一次api,退出页面时在调用一次api,进入页面可以搭配浏览商品列表使用,时间由sdk内部进行集成。

进入页面
const aps = new APS

// 配合浏览商品列表
aps.browse({
  user_id: '', // 用户id
  product_name: 'name1/ name2/ name3' // 名称以/进行分割
})

// 不配合商品列表
aps.browse({
  user_id: '' // 用户id
})
退出页面

uni-app的使用方式和传统node环境有所区别, uni-app在编译成小程序后, 页面退出的生命周期为onHide, 但是一个微信小程序归根到底是一个应用, 当用户直接用手机的任务管理器关闭小程序时onHide是无法进行监听, 所以应该使用onHideonUnload

const aps = new APS

onHide: function() {
  const aps = new APS
  aps.browse({
    user_id: this.userInfo.uid ? this.userInfo.uid : ''
  })
},

onUnload: function() {
  const aps = new APS
  aps.browse({
    user_id: this.userInfo.uid ? this.userInfo.uid : ''
  })
}

支付商品

const aps = new APS

aps.buy({
  user_id: '', // 用户id
  pay_type: 0, // 支付类型
  product_id: '', // 商品id
  product_name: '' // 商品名称
})

聚合支付商品

const aps = new APS

aps.buy({
  user_id: '', // 用户id
  pay_type: 0, // 支付类型
  product_name: "[{name: '商品名称', id: '商品id'}, {name: '商品名称', id: '商品id'}]"
})

退货

const aps = new APS

aps.returnPurchase({
  user_id: '', // 用户id
  product_id: '', // 商品id
  product_name: '' // 商品名称
})

聚合支付退货

const aps = new APS

aps.returnPurchase({
  user_id: '', // 用户id
  product_name: "[{name: '商品名称', id: '商品id'}, {name: '商品名称', id: '商品id'}]"
})