anchor-point-statistics
全平台用户行为统计,需要配合后端
3,704
| Install | |
|---|---|
npm install anchor-point-statistics@1.0.49 |
|
| Latest Version: | 1.0.49 |
| Older releases: | 2 |
| License: | MIT |
| Last Updated: | Nov 6, 2020 |
| Links: | GitHub · npm |
Maintainer: songjianet
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是无法进行监听,
所以应该使用onHide和onUnload。
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'}]"
})
Related Packages
Version History
| Version | Released | License |
|---|---|---|
| 1.0.49 | MIT | |
| 1.0.48 | MIT | |
| 1.0.47 | MIT | |
| 1.0.46 | MIT | |
| 1.0.45 | MIT | |
| 1.0.44 | MIT | |
| 1.0.43 | MIT | |
| 1.0.42 | MIT | |
| 1.0.41 | MIT | |
| 1.0.40 | MIT | |
| 1.0.39 | MIT | |
| 1.0.38 | MIT | |
| 1.0.37 | MIT | |
| 1.0.36 | MIT | |
| 1.0.35 | MIT | |
| 1.0.34 | MIT | |
| 1.0.33 | MIT | |
| 1.0.32 | MIT | |
| 1.0.31 | MIT | |
| 1.0.30 | MIT | |
| 1.0.29 | MIT | |
| 1.0.28 | MIT | |
| 1.0.27 | MIT | |
| 1.0.25 | MIT | |
| 1.0.24 | MIT | |
| 1.0.23 | MIT | |
| 1.0.22 | MIT | |
| 1.0.21 | MIT | |
| 1.0.20 | MIT | |
| 1.0.17 | MIT |
Showing the latest 30 of 125. See every release on npm