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

@jushuitan/jst-track

v1.1.0

Published

聚水潭前端SLS日志埋点

Downloads

6

Readme

jst-前端日志埋点

接入方式

cdn引入

// 这里的版本号和package.json内的version统一
<script src="https://static.jushuitan.com/static/js/lib/track/1.1.0/jst-track.js"></script>


<script>
     track({
           app_key:'jst-gyl-channel',	//应用唯一编号
           event_id:3001,	//事件编号, 2001=页面进入,2002=页面离开,3001=控件点击
           co_id:'1000',	//用户所在公司编号
           user_id:'100000',	//用户编号
           channel_id:'jst-web',	//渠道来源ID, 可以通过url的ffrom字段传入
           duration:'10000',	//页面访问时长,单位秒
           element:'banner',	//控件编码
           element_args:{
               name:'jugongdan'
           },	//控件参数
           nextPageSend:true, // 【特别注意】是否在下一个页面发送请求,只在点击跳转事件下使用
           is_track_prod:false,  // 生产环境才上报,其他环境只会console.log
           aliyunHost:'default'  // default 国内埋点环境(默认可不传) ,overseas 海外埋点环境
     });
</script>

七牛云cdn打包上传地址: https://portal.qiniu.com/kodo/bucket/resource?bucketName=jst-static

使用私有npm引入

npm i jst-track -S
import sendTrackData from 'jst-track';


sendTrackData({
        app_key:'jst-gyl-channel',	//应用唯一编号
        event_id:3001,	//事件编号, 2001=页面进入,2002=页面离开,3001=控件点击
        co_id:'1000',	//用户所在公司编号
        user_id:'100000',	//用户编号
        channel_id:'jst-web',	//渠道来源ID, 可以通过url的ffrom字段传入
        duration:'10000',	//页面访问时长,单位秒
        element:'banner',	//控件编码
        element_args:{
            name:'jugongdan'
        },	//控件参数
        nextPageSend:true, // 【特别注意】是否在下一个页面发送请求,只在点击跳转事件下使用
        is_track_prod:false,  // 生产环境才上报,其他环境只会console.log
        aliyunHost:'default'  // default 国内埋点环境(默认可不传) ,overseas 海外埋点环境
});

特别说明:

  1. nextPageSend: 在点击跳转事件中,一定要设置nextPageSend为true, 这样发送的埋点信息会暂存在 localStorage中,key为preTrack; 跳转到下一个页面后,埋点库会自动读取localStorage中的preTrack值,上报后,并清除记录;

  2. channel_id : 渠道来源字段,取值逻辑优先级 从url的ffrom字段获取(并且sdk会自动备份在cookies的session中), 从cookies中的channel_id字段,从localhost中获取

文档:

  • 埋点接入方式:https://jushuitan.yuque.com/wg3wz7/otnwwo/zkats0
  • 完整参数文档:https://jushuitan.yuque.com/docs/share/34717910-c1db-4300-b560-28c4ff7c5bd8?#