
Security News
TC39 Advances Temporal to Stage 4 Alongside Several ECMAScript Proposals
TC39’s March 2026 meeting advanced eight ECMAScript proposals, including Temporal reaching Stage 4 and securing its place in the ECMAScript 2026 specification.
jstatistics
Advanced tools
安装
npm install --save jstatistics
使用
到这个网站http://test-iappweb.jpushoa.com/front-stat/建个统计项目,然后把下面例子的ID "12" 改成你的。
import { StatisticsModule } from 'jstatistics';
const d=new Date();
d.setHours(d.getHours() + 24);
export interface Option {
useHash?: boolean;
captureHttp?: boolean;
captureError?: boolean;
captureRouteChange?: boolean;
user_id?: string;
log?: boolean;
host: string;
data?: Date;
}
const defaultOption = {
useHash: false, // 默认前端路由是h5 history
captureError: false, // 自动监听window.onerror,并发送统计
captureHttp: true, // 拦截http请求
captureRouteChange: true, // 拦截路由跳转
log: true, // 是否输出日志
user_id: 'xxxxx',
host: 'xxxx' ,// 后台服务器地址
date: d // 默认1天后cookie过期
};
@NgModule({
...
imports: [
...
StatisticsModule.forRoot('12', { host: '123' })
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {
}
import { StatisticsService } from 'jstatistics';
@Component({
...
})
export class AppComponent {
title = 'app';
constructor(private stat: StatisticsService) {
console.log(stat);
}
}
方法
setUserId(id: string): this; // 设置用户ID
clearUserId(): this; // 清除用户ID
error(e: Error): Promise<{}>; // 发送报错信息
addNetworkListener(cb: Function): void; // 添加网络请求的监听
events(events: string[], extras?: {
[propName: string]: string;
}): Promise<{}>; // 发送事件
uteReport(data: any): Promise<{}>; // 上报ute报告
setChangeURL(url: any): Promise<{}>; //再配置中关闭自动url切换上报,手动上报方法
setCookie(key: any, value: any, expires?: Date): void; //expires默认和其他cookie保持一致,通过client_id_expires的cookie拿到
更新
2.1.0
Statustics 这个单词写错了,改成了 StatisticsService。在2.1.0中修复了
2.8.0
referrer信息放在cookie,默认一天过期
script引入
从node_modules/jstatistics/build/output/statistics.js 拷出来
<script src="/assets/js/statistics.js"></script>
<script>
window['stat'] = new Statistics('12', { log: false, host: 'http://183.232.42.221:8091' });
</script>
declare const stat;
stat.xx //使用
CDN
https://o8ci6tgz8.qnssl.com/jstatistics/{ 版本号 }/statistics.js
FAQs
We found that jstatistics demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
TC39’s March 2026 meeting advanced eight ECMAScript proposals, including Temporal reaching Stage 4 and securing its place in the ECMAScript 2026 specification.

Research
/Security News
Since January 31, 2026, we identified at least 72 additional malicious Open VSX extensions, including transitive GlassWorm loader extensions targeting developers.

Research
Six malicious Packagist packages posing as OphimCMS themes contain trojanized jQuery that exfiltrates URLs, injects ads, and loads FUNNULL-linked redirects.