From weblog-sdk
埋点上报 SDK 使用指南。当用户需要上报埋点时触发,包括:如何使用 @thsf2e/weblog 进行埋点上报、setConfig 配置、report 上报方法、SSR 环境支持、CDN 引用、组件自动拼接等功能。
npx claudepluginhub doublewater777/futures-plugins-frontend --plugin weblog-sdkThis skill uses the workspace's default tool permissions.
```javascript
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Analyzes BMad project state from catalog CSV, configs, artifacts, and query to recommend next skills or answer questions. Useful for help requests, 'what next', or starting BMad.
import { setConfig, report } from '@thsf2e/weblog';
// 国内上报
setConfig({ appKey: 'xxxx' })
report({
id: 'ths_xxx_page_element_action',
action: 'click',
logmap: { /* 自定义字段 */ }
})
// 海外上报
setConfig({
appKey: 'xxxx',
domain: 'stat.ainvest.com'
})
import { setConfig, report, reportLeft } from '@thsf2e/weblog';
setConfig({
appKey: 'xxxx',
userAgent: context.userAgent, // 必传
deviceId: 'xxxx', // 必传
userId: 'xxxx', // 必传
domain: 'stat.ainvest.com' // 海外必传
})
// 页面跳转前调用
reportLeft()
<script src="//s.thsi.cn/cb?cd/weblog/0.0.5/weblog.js"></script>
<script>
window.weblog.setConfig({ appKey: 'xxxx' })
window.weblog.report({ id: 'xxx', action: 'click' })
</script>
// 页面设置前缀
setConfig({
appKey: 'xxxx',
logPrefix: 'ths_tgpt_askdetail' // 自动拼接为三段式
})
// 组件内只需二段式
report({ id: 'pageBot_checkAgree', action: 'click' })
// 实际发送: ths_tgpt_askdetail_pageBot_checkAgree
// vue.config.js
configureWebpack: {
externals: { '@thsf2e/weblog': 'weblog' }
}
// vite.config.js
build: {
rollupOptions: {
external: ['@thsf2e/weblog'],
plugins: [externalGlobals({ '@thsf2e/weblog': 'weblog' })]
}
}
从 references/api.md 获取完整 API 文档: