🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

pf-xiaochengxu-pvuv

Package Overview
Dependencies
Maintainers
3
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pf-xiaochengxu-pvuv

小程序埋点代码

1.0.8
latest
npm
Version published
Weekly downloads
2
100%
Maintainers
3
Weekly downloads
 
Created
Source

说明

小程序专用埋点功能

安装

npm i pf-xiaochengxu-pvuv
or
yarn add pf-xiaochengxu-pvuv

使用

// main.js
// 1.0.1 版本以上写法
import { pvuv } from 'pf-xiaochengxu-pvuv'
// 1.0.1 版本以下写法
import pvuv from 'pf-xiaochengxu-pvuv'

const pvuv = new pvuv({
	mapKey: '******', // 地图key
	systemId: '***', // 系统 id, 不同的项目有不同的 id
	url: '***'
})
uni.pvuv = pvuv;

// manifest.json
"mp-weixin" : {
    // ......
    "permission" : {
        "scope.userLocation": {
            "desc": "你的位置信息将用于小程序位置接口的效果展示"
        }
    }
}

API

初始化参数

参数名说明类型是否必填
mapKey高德地图key,如果不填则不进行地图信息获取string***false
systemId系统IDstring''true
url埋点请求地址string***true

方法

埋点方法 pvuv.sendLogMonitor_pvuv(pointId, userId, otherParams)

参数名说明类型默认值是否必填
pointId埋点idstring-true
userId用户idstring-false
otherParams其他供埋点分析的参数Object-false

设置系统id pvuv.setSystemId(value)

参数名说明类型默认值是否必填
valuestring-true

注意

需要将以下地址添加到小程序的白名单中

  • https:*** 埋点接口
  • https://restapi.amap.com 高德地图接口

npm 发布

  • 提交代码(无需push到github仓库)
  • npm run build (打包)
  • npm version patch (自动升级 package.json 中的 version,如果手动改后,则不需要执行这个命令)
  • npm publish (发布)

发布注意

  • 需要在命令行工具中登录 npm , 执行 npm login
  • 登录 npm 不能使用淘宝代理,需要执行 npm config set registry https://registry.npmjs.org/ 将代理设置为 npmjs

FAQs

Package last updated on 15 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts