Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
fast-tracker-browser
Advanced tools
使用Yarn进行安装(推荐)
yarn add fast-tracker-browser
使用npm进行安装
npm install fast-tracker-browser
建议登录天眼平台按照前端应用接入指引使用
如对该工具比较熟悉,可自行进行配置,请在应用程序入口添加以下代码
// 引入探针
import fastTracker from 'fast-tracker-browser';
// 引入配置文件
import fastTrackerConfig from '这里需要自行创建一个JSON配置文件';
// 使用配置执行探针初始化
fastTracker(config);
JSON配置文件内容
{
"endpoint": "",
"app": "",
"is_spa": true,
"include_search": false,
"log_content_attribute": "data-log",
"log_event_attribute": "data-event",
"log_module_attribute": "data-module",
"report_api_params": false,
"api_ignore_urls": [],
"ignore_pages": [],
"collect_event_types": ["event","page","click","api","error","crash"],
"tenant_reader": {
"key": "",
"range": ["url","localstorage","sessionstorage","cookie","window"]
},
"real_user_reader": {
"key": "",
"range": ["url","localstorage","sessionstorage","cookie","window"]
},
"user_group_reader": {
"key": "",
"range": ["url","localstorage","sessionstorage","cookie","window"]
},
"app_version_reader": {
"key": "",
"range": ["url","localstorage","sessionstorage","cookie","window"]
},
"trace_config": {
"rules": [],
"headers": []
},
"replay": {
"error": false
}
}
配置项 | 配置描述 | 是否必填 | 默认值 | 说明 | 配置示例 |
---|---|---|---|---|---|
endpoint | 探针上报地址 | 是 | 无 | 在天眼平台下载的配置会自动注入当前所属产品前端日志库的上报地址 | "https://fast-logstore.mypaas.com/xxxxxx" |
app | 应用名称 | 否 | 无 | 在天眼平台下载的配置中会自动注入创建产品时填写的名称 | "analysis" |
include_search | 开启页面地址参数采集 | 否 | true | 开启后将页面URL的参数(search)部分上报为page_search字段 | true |
ignore_pages | 按页面禁用日志采集 | 否 | [] | 将屏蔽配置的列表中匹配到的页面的所有事件采集 | [".mypaas.com",".baidu.com"] |
tenant_reader | 租户读取 | 否 | {key: "",range:["url","localstorage","sessionstorage","cookie","window"]} | 根据配置的key在range指定的范围内按先后顺序读取作为tenant字段上报 | {key:"org_code",range:[”localstorage“]} |
real_user_reader | 用户读取 | 否 | {key: "",range:["url","localstorage","sessionstorage","cookie","window"]} | 根据配置的key在range指定的范围内按先后顺序读取作为real_user_id字段上报 | {key:"userinfo.code",range:[”localstorage“]} |
user_group_reader | 用户分组读取 | 否 | {key: "",range:["url","localstorage","sessionstorage","cookie","window"]} | 根据配置的key在range指定的范围内按先后顺序读取作为user_group字段上报 | {key:"userinfo.role",range:[”localstorage“]} |
app_version_reader | 应用版本读取 | 否 | {key: "",range:["url","localstorage","sessionstorage","cookie","window"]} | 根据配置的key在range指定的范围内按先后顺序读取作为app_version字段上报 | {key:"version",range:[”window“]} |
log_event_attribute | 申明式埋点事件名称属性名称 | 否 | data-event | click事件中指定作为event字段上报的由DOM读取的属性名 | data-eventname |
log_content_attribute | 申明式埋点事件内容属性名称 | 否 | data-log | click事件中指定作为logs字段上报的由DOM读取的属性名 | data-content |
log_module_attribute | 申明式埋点事件模块属性名称 | 否 | data-module | click事件中指定作为module字段上报的由DOM读取的属性名 | data-mod |
collect_event_types | 采集事件类型 | 否 | !!#ff9900 ["page","api","click","error","crash","event"]!! | 按照事件类型指定需要采集的日志 | ["page","api"] |
is_spa | 开启单页应用页面切换采集 | 否 | true | 开启后将增加history.pushState、history.replaceState、hashchange事件、popstate事件的监听,用于单页应用路由切换监听 | true |
report_api_params | 开启API调用参数采集 | 否 | false | 开启后将开始采集api的参数,包含querystring以及requestbody部分 | true |
api_ignore_urls | 忽略采集的API地址 | 否 | [] | 列表中匹配到的API地址不采集API日志,默认屏蔽endpoint以及其他同类产品的采集请求 | ["fast.mypaas.com/api/log"] |
api_url_regx | API地址截取 | 否 | "" | 这个配置还需要继续改造,暂未在配置表单中体现 | "" |
trace_config | 打通前后端调用链路 | 否 | !!#ff9900 {rules:[],headers:[]}!! | 开启后针对rules中匹配域名的API,将添加headers中的自定义请求头,默认会添加x-fast-trace-id请求头 | {rules:["fast.mypaas.com"],headers:[{name:"x-fast-uid",type:"built-in",value:"u"}]} |
replay | 开启前端错误视频录制 | 否 | {error:false} | 开启后,发生前端错误时,将同时采集错误发生前一小段时间的视频 | {error: true} |
debug | 开启调试模式 | 否 | false | 目前暂时没有明确作用,不在配置表单中体现 | false |
API名称 | API描述 | 参数说明 |
---|---|---|
registUser({tenant_code,user_account,user_group}) | 注册用户信息 | 参数与上报字段对应关系:tenant_code→tenant,user_account→real_user_id,user_group→user_group |
setBasicInfo({custom_data,app_hotupdate_version}) | 设置附加日志内容 | custom_data公共附加信息,!!#ff9900 |
report(eventName, logs, eventModule, forceMode) | 上报埋点日志 | eventName事件名称(event字段),logs日志内容(需要JSON OBJECT,追加到logs中),eventModule事件所属模块(module字段),forceMode强制上报模式(0普通,1创建日志后立即异步上报,2创建日志后立即同步上报) |
reportError(errorData, extraInfo) | 上报前端错误 | errorData错误对象(需要使用new Error等方式创建),extraInfo错误附加信息(作为logs.extraInfo上报) |
FAQs
The npm package fast-tracker-browser receives a total of 9 weekly downloads. As such, fast-tracker-browser popularity was classified as not popular.
We found that fast-tracker-browser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.