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

yq-analytics

v1.3.6

Published

clientLog前缀的方法为前端日志,其它方法为埋点。 ## 安装 ### NPM 1. npm install --save yq-analytics

Downloads

29

Readme

说明

clientLog前缀的方法为前端日志,其它方法为埋点。

安装

NPM

  1. npm install --save yq-analytics

  2. 导入 import yqAnalytics from "yq-analytics"

直接用 script 引入

  1. js文件cdn地址 https://assets.rurushishi.com/jssdk/yq-analytics.js
  2. 使用 window.yqAnalytics

用法

埋点用法

  1. 程序启动时调用 yqAnalytics.init (注意:init要在使用其它方法之前调用)
  2. 在获取到yqAnalytics.setUserInfo方法的任意一个参数的时机,都执行下yqAnalytics.setUserInfo
  3. 在页面打开的事件里调用yqAnalytics.pageOpen和yqAnalytics.triggerEvent('openPage',事件属性)
  4. 在需要记录的事件调用yqAnalytics.triggerEvent(事件id,事件属性)

自用说明(原圈内部用法)

  1. 建议写一个辅助函数用来添加propertyValue通用属性。可参考: sales-center-uniapp库utils/biz.js, yq-rs-desk库utils/biz.js。

通用属性说明:

| Param | Description | | --- | --- | | pageUrl | 页面路径(路由路径,非含域名的完整链接) | | pageQuery | 页面参数 | | pageQueryScene | 小程序码scene | | pageTitle | 页面标题 | | mpScene | 启动小程序的场景值 | | adPushId | 投放Id | | appId | 公众号或小程序appId | | openId | 公众号或小程序openId | | refereeopenid | 上级传播者 | | rscuid | 传播销售 | | channel | 传播渠道 | | projectId | 项目Id | | gcj02 | 国家测量局02号标准坐标系统 | | bizId | 业务Id | | bizType | 业务类型 | | brand | 设备品牌 | | model | 设备型号 |

通用属性所有参数均为非必填。

bizType业务类型说明: | Name | Description | | --- | --- | | act | 活动 | | questionnaire | 问卷 | | t1 | 获客内容底部菜单样式 | | t2 | 获客内容漂浮样式 | |tp1|神奇包裹| |t3|很多客文章| |t4|很多客楼盘信息| |t5|很多宝创建页面| |t6|很多客使用指南| |tp6|筑巢3D沙盘| |t7|楼盘信息| |t8|很多客楼盘信息2| |t9|售楼中心首页| |t10|VR带看| |t11|直播推广页面| |t12|汽车详情页| |t13|汽车销售中心首页| |tp100|摩西游戏|

  1. 添加必须的页面事件:

页面浏览(统计浏览时长) yqAnalytics.pageOpen

触发事件-页面打开 eventId:'openPage' propertyValue:JSON.stringify(通用属性)

  1. 添加必须的触发事件:

留电 eventId:'entryPhoneNumber' propertyValue:JSON.stringify({通用属性,...{phoneNumber:'手机号'}})

分享 eventId:'share' propertyValue:JSON.stringify(通用属性)

Functions

clientLogSetId(id)

ClientLog 设置id

Kind: global function

| Param | Type | Description | | --- | --- | --- | | id | Number | id |

clientLogSetUserId(userId)

ClientLog 设置userId

Kind: global function

| Param | Type | Description | | --- | --- | --- | | userId | String | userId |

clientLog(filterMsg, content)

ClientLog 记录info日志

Kind: global function

| Param | Type | Description | | --- | --- | --- | | filterMsg | String | 关键词 | | content | Any | 内容 |

clientLogWarn(filterMsg, content)

ClientLog 记录warn日志

Kind: global function

| Param | Type | Description | | --- | --- | --- | | filterMsg | String | 关键词 | | content | Any | 内容 |

clientLogError(filterMsg, content)

ClientLog 记录error日志

Kind: global function

| Param | Type | Description | | --- | --- | --- | | filterMsg | String | 关键词 | | content | Any | 内容 |

init(params)

初始化

Kind: global function

| Param | Type | Description | | --- | --- | --- | | params | Object | 初始化参数 | | params.appId | String | appId | | [params.env] | String | 设置环境 prod(默认)、test | | [params.baseURL] | String | 接口请求的baseURL |

setUserInfo(params)

设置用户

Kind: global function

| Param | Type | Description | | --- | --- | --- | | params | Object | 用户信息 | | [params.openId] | String | 用户openId | | [params.phoneNumber] | String | 用户手机号 | | [params.unionId] | String | 用户unionId |

pageOpen(params)

页面打开事件

Kind: global function

| Param | Type | Description | | --- | --- | --- | | params | Object | 页面信息 | | params.pageUrl | String | 页面路径 | | params.propertyValue | String | 页面属性值json串 |

appHide()

App从前台进入后台

Kind: global function

triggerEvent(params)

触发事件

Kind: global function

| Param | Type | Description | | --- | --- | --- | | params | Object | 事件信息 | | params.eventId | String | 事件id | | [params.propertyValue] | String | 事件属性值json串 |

getUserLastViewPage(params)

获取用户最后一次浏览的页面

Kind: global function

| Param | Type | Description | | --- | --- | --- | | params | * | | | params.openId | String | 用户openId |

getUserPageTriggerRecord(params)

获取用户页面停留记录

Kind: global function

| Param | Type | Description | | --- | --- | --- | | params | * | | | params.beginTime | String | 开始时间 | | [params.endTime] | String | 结束时间,空表示当前时间 | | [params.openId] | String | 用户openId,openId、unionId、手机号不能同时为空 | | [params.phoneNumber] | String | 手机号,openId、unionId、手机号不能同时为空 | | [params.unionId] | String | 用户unionId,openId、unionId、手机号不能同时为空 |