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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@hfaxjs/data-report

v1.0.0

Published

hfax data report plugin

Downloads

3

Readme

Introduce

@hfaxjs 数据埋点插件,目前集成神策sdk。

Getting Started

需要安装@hfaxjs/core 核心库


cnpm install @hfaxjs/core --save
cnpm install @hfaxjs/data-report --save

Usage


import hfax from '@hfaxjs/core';
import dataReport from '@hfaxjs/data-report';

//init
hfax.use(dataReport,{
    server_url:process.env.VUE_APP_HFAXJS_DATAREPORT_URL, //必填 服务地址
    registerPageConfig:{ //公共扩展字段, 按照项目需求为主,加上之后 调用track方法会在上报中加上公共参数
      platform_type:"xx", 
      app_name:"xx",    
      is_enrolled: false,  
    },
})

//test
hfax.dataReport.track("xx", {
    button_title: "xx"
});

Configuration


// 配置参数  详细参考 https://www.sensorsdata.cn/manual/js_sdk.html#14-%E5%8F%82%E6%95%B0%E9%85%8D%E7%BD%AE 
export interface dataReportConfig{
    /* 必填参数  */
    name: string;  // 使用的一个默认的全局变量 如定义成 sensors 的话,后面可以使用 sensors.track() 用来跟踪信息
    server_url: string; //数据接收地址
    /* 可选参数 */
    heatmap: object;   //点击图配置         
    cross_subdomain: boolean;
    show_log: boolean;
    source_channel: number[];
    is_track_device_id: boolean;
    send_type: string;  
    callback_timeout: number;
    queue_timeout: number;
    datasend_timeout: number;
    preset_properties: object;
    is_track_single_page: boolean;
    batch_send: boolean;
    /* 扩展参数 */
    isRegisterPage: boolean;    //是否需要注册页面公共属性
    registerPageConfig:object;  //注册页面公共属性配置参数对象 isRegisterPage为true时该项必填
    
}  

Api

track(event_name[, properties][, callback])

使用 hfax.dataReport.track(event_name[, properties][, callback]) 记录事件(触发的事件会存储到神策分析系统的 events 表中)

event_name: string,必选。表示要追踪的事件名。 properties: object,可选。表示这个事件的属性。 callback: function,可选。表示已经发送完数据之后的回调。

示例:

  hfax.dataReport.track("hfax_keybutton_click", {
    button_title: "产品详情页点击立即出借按钮"
  })

getDistinctId()

使用 hfax.dataReport.getDistinctId() 获取未登录用户匿名id

login(userID)

使用 hfax.dataReport.login(userID) 关联登录用户

userID: 用户登陆后的userID 。

示例:

  hfax.dataReport.login('xxxxxxxx')

Version

current version:1.0.0