feat: 已完成的工作:
- ✅ 创建了4个P1优先级Hook(搜索、导航、个人资料、订阅) - ✅ 将其中3个Hook集成到5个组件中 - ✅ 在个人资料、设置、搜索、订阅流程中添加了15+个追踪点 - ✅ 覆盖了完整的收入漏斗(支付发起 → 成功 → 订阅创建) - ✅ 添加了留存追踪(个人资料更新、设置修改、搜索查询) 影响: - 完整的用户订阅旅程可见性 - 个人资料/设置参与度追踪 - 搜索行为分析 - 完整的支付漏斗追踪(微信支付)
This commit is contained in:
@@ -44,11 +44,15 @@ import {
|
||||
import { EditIcon, CheckIcon, CloseIcon, AddIcon } from '@chakra-ui/icons';
|
||||
import { useAuth } from '../../contexts/AuthContext';
|
||||
import { logger } from '../../utils/logger';
|
||||
import { useProfileEvents } from '../../hooks/useProfileEvents';
|
||||
|
||||
export default function ProfilePage() {
|
||||
const { user, updateUser } = useAuth();
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
// 🎯 初始化个人资料埋点Hook
|
||||
const profileEvents = useProfileEvents({ pageType: 'profile' });
|
||||
const [newTag, setNewTag] = useState('');
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
const fileInputRef = useRef();
|
||||
@@ -95,6 +99,12 @@ export default function ProfilePage() {
|
||||
updateUser(updatedData);
|
||||
setIsEditing(false);
|
||||
|
||||
// 🎯 追踪个人资料更新成功
|
||||
const updatedFields = Object.keys(formData).filter(
|
||||
key => user?.[key] !== formData[key]
|
||||
);
|
||||
profileEvents.trackProfileUpdated(updatedFields, updatedData);
|
||||
|
||||
// ✅ 保留关键操作提示
|
||||
toast({
|
||||
title: "个人资料更新成功",
|
||||
@@ -105,6 +115,10 @@ export default function ProfilePage() {
|
||||
} catch (error) {
|
||||
logger.error('ProfilePage', 'handleSaveProfile', error, { userId: user?.id });
|
||||
|
||||
// 🎯 追踪个人资料更新失败
|
||||
const attemptedFields = Object.keys(formData);
|
||||
profileEvents.trackProfileUpdateFailed(attemptedFields, error.message);
|
||||
|
||||
// ✅ 保留错误提示
|
||||
toast({
|
||||
title: "更新失败",
|
||||
@@ -128,6 +142,9 @@ export default function ProfilePage() {
|
||||
reader.onload = (e) => {
|
||||
updateUser({ avatar_url: e.target.result });
|
||||
|
||||
// 🎯 追踪头像上传
|
||||
profileEvents.trackAvatarUploaded('file_upload', file.size);
|
||||
|
||||
// ✅ 保留关键操作提示
|
||||
toast({
|
||||
title: "头像更新成功",
|
||||
|
||||
Reference in New Issue
Block a user