🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

nw-log

Package Overview
Dependencies
Maintainers
8
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nw-log

> 打点组件

latest
npmnpm
Version
2.3.0
Version published
Maintainers
8
Created
Source

nw-log

打点组件

安装

$ yarn add nw-log

example

import Log, {ENV} from 'nw-log';

const log = new Log({
    env: ENV.GA,
    key: 'comic',
    userId: '23223' 
});

log.capture('hds-2:nwe,sdf,s');

哈勃平台实例化完毕之后即可统计pv,uv

API

Classes

Log

Log

Log

Log

Kind: global class

new Log(props)

ParamTypeDefaultDescription
propsObject
props.userIdstring用户id
props.keystring产品id(哈勃平台传入AppKey)
[props.env]ENVENV.ST环境,ENV.ST记录到打点验证平台,ENV.GA记录到ga平台,ENV.HB记录到哈勃平台,默认记录到打点验证平台

ENV : enum

Enum env values.

Kind: global enum
Read only: true
Properties

NameTypeDefault
STstring"ST"
GAstring"GA"
HBstring"HB"

关于登录

哈勃会自动生成一个deviceUDID存储在cookie中,作为匿名用户的唯一标识,但是在用户登录之后,推荐传入一个userId,用于标识登录用户,这对数据分析有帮助。

调用此方法之后,后续的事件都会使用这新的userId

log.login(userId)

切换成匿名用户

log.logout()

FAQs

Package last updated on 30 Apr 2021

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