
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
@deppon/deppon-log
Advanced tools
@deppon/deppon-log前端埋点工具库(自研上报,不依赖神策 SDK)
npm install @deppon/deppon-log
import depponLog from '@deppon/deppon-log';
// 初始化(可覆盖默认上报地址)
depponLog.init(process.env.NODE_ENV, {
server_url: 'https://your-api.com/salog/api/events',
app_name: 'my-app',
send_type: 'beacon', // beacon | fetch
});
// 自定义事件埋点
depponLog.eventTrack('button_click', {
id: 1,
name: 'test',
});
| 环境 | 默认 server_url |
|---|---|
| production | https://dot.Deppon.com/salog/api/events |
| 其他 | https://dot.Deppon.net/salog/api/events |
请求体为 JSON,POST 或 sendBeacon,示例:
{
"type": "track",
"event": "button_click",
"distinct_id": "匿名ID",
"login_id": "登录用户ID",
"app_name": "my-app",
"time": 1716000000000,
"properties": {
"url": "https://...",
"uuid": "...",
"platformType": "H5"
}
}
后端需实现对应接口并完成入库;字段可按平台规范扩展。
接口详细说明见:docs/api-events.md
import { createApp } from 'vue';
import { VuePlugin } from '@deppon/deppon-log';
import router from './router';
const app = createApp(App);
app.use(VuePlugin, {
router,
});
app.mount('#app');
<template>
<button v-log="'button_click'">点击按钮</button>
<button v-log:property="{ id: 1, name: 'test' }" v-log="'button_click'">点击</button>
</template>
<template>
<div v-log:exposure="'element_exposure'">内容区域</div>
</template>
<script setup>
import { useLog } from '@deppon/deppon-log';
const log = useLog();
const handleClick = () => {
log.eventTrack('button_click', { id: 1 });
};
</script>
| 字段 | 说明 |
|---|---|
server_url | 埋点上报 API(必填,可由 init 覆盖) |
show_log | 非生产环境是否在控制台打印 |
send_type | beacon(默认)或 fetch |
app_name | 应用标识,写入上报体 |
enable_page_leave | 是否采集页面离开时长,默认 true |
init(develop, property) - 初始化eventTrack(event_name, properties, callback?) - 自定义事件eventQuick('autoTrack', properties) - 页面浏览($pageview)login(user_id) - 绑定登录用户changeDistinctId(distinct_id) - 匿名 IDdata-sensors-click-event-name - 点击事件名data-sensors-exposure-property-* - 附加属性sa-sdk-javascript 及神策热力图/曝光插件sa.gif$WebPageLeave,路由页浏览仍为 $pageview,便于后端迁移映射FAQs
Frontend event tracking toolkit
The npm package @deppon/deppon-log receives a total of 375 weekly downloads. As such, @deppon/deppon-log popularity was classified as not popular.
We found that @deppon/deppon-log demonstrated a healthy version release cadence and project activity because the last version was released less than 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
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.