Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bxs-lib-weapp-analytics

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bxs-lib-weapp-analytics

bxs 小程序埋

  • 1.0.5
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

小程序埋点

因为小程序中无法使用dom进行埋点的记录,本项目使用纯ajax请求的方式实现,api调用基本同lib-analytics一致

如何使用

npm install bxs-lib-weapp-analytics

import * as WeiyiStatSDK from 'bxs-lib-weapp-analytics'

WeiyiStatSDK.init(options)

在小程序后台 开发-> 开发设置-> request合法域名 中添加埋点url地址 wy-analysis.cn-hangzhou.log.aliyuncs.com。目前测试环境和线上环境使用的域名是同一个,所以只要配置一个。

Api

init(options:Object)
init({
 pageId: '',
 isProduct: true,
 projectInfo: {}
})

submit(eId:String, options:Object)

submit('eId', {
    mydata: 'mydata'
})

onHide()

onHide()

onLoad()

onLoad()

onUnload()

onUnload()

以上三个方法分别对应了小程序 同名页面事件,如需记录可调用

由于埋点接口默认约定使用 mc,u来记录用户的属性,这些属性已经按照默认约定写死在cookie的固定字段中,因为小程序中默认无法通过接口设置cookie,所以本项目提供了两个接口来写mc和u,具体含义请联系相关开发人员

setU(u:String)

setU('xxxxxx')

setMC(mc:String)

setMC('xxxxxx')

FAQs

Package last updated on 24 Jul 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc