feat(miniprogram): 埋点事件追踪服务
Some checks failed
CI / rust-check (push) Has been cancelled
CI / rust-test (push) Has been cancelled
CI / frontend-build (push) Has been cancelled
CI / security-audit (push) Has been cancelled

- 新增 analytics.ts:trackEvent/trackPageView/flushEvents
- 事件队列本地缓存,批量上报到 /analytics/batch
- 首页 page_view、预约创建、随访提交、健康数据录入四个关键埋点
This commit is contained in:
iven
2026-04-24 13:02:08 +08:00
parent afc307e373
commit 030afb8213
5 changed files with 90 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import Taro, { useRouter } from '@tarojs/taro';
import { getTaskDetail, submitRecord } from '../../../services/followup';
import type { FollowUpTask } from '../../../services/followup';
import { TEMPLATE_IDS } from '@/services/wechat-templates';
import { trackEvent } from '@/services/analytics';
import Loading from '../../../components/Loading';
import ErrorState from '../../../components/ErrorState';
import './index.scss';
@@ -42,6 +43,7 @@ export default function FollowUpDetail() {
content: { text: content.trim() },
});
Taro.showToast({ title: '提交成功', icon: 'success' });
trackEvent('followup_submit', { task_id: id });
const tmplId = TEMPLATE_IDS.FOLLOWUP_REMINDER;
if (tmplId) {
try { await Taro.requestSubscribeMessage({ tmplIds: [tmplId] }); } catch { /* 用户拒绝 */ }