Socket
Socket
Sign inDemoInstall

@hypers/hwa-sdk

Package Overview
Dependencies
0
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @hypers/hwa-sdk

Hyper Web Analytics JS SDK


Version published
Weekly downloads
4
increased by100%
Maintainers
2
Created
Weekly downloads
 

Readme

Source

hwa-sdk-js

hwa-sdk-js 是对 hwt.js 的一个封装

安装

npm i @hypers/hwa-sdk

快速开始

import HyperWebAnalytics from '@hypers/hwa-sdk';

const hwa = new HyperWebAnalytics();

// projectId 应该以实际获取的 ID 为准
hwa.create('projectId');
hwa.sendPageview();

示例

开启全埋点

hwa.create('projectId', {
  auto_track: true,
});

带参数的页面跟踪

// 传递 title 与 url
hwa.sendPageview({
  title: '登录页面',
  url: '/index.html#login',
});

用户行为跟踪

// 一个男性用户关注了 5 个领域的标签,这里的标签也是存在多个,所以采用了数组的类型。
hwa.sendAction('follow', {
  labels: ['数码', '音乐', '体育', '篮球', '动漫'],
  gender: '男',
});

更多功能

API

// 创建跟踪对象
hwa.create(projectId, [options], [callback]);

// 认证用户信息
hwa.identify([options]);

// 页面访问跟踪
hwa.sendPageview([options], [callback]);

// 行为跟踪
hwa.sendAction(name, [params], [callback]);

// 表单跟踪
hwa.sendForm([params], [callback]);

API 参数详细说明

Keywords

FAQs

Last updated on 25 Sep 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc