feat(analytics): add custom event tracking to Context, SkillTree, Planta, Questions

Add app-specific Umami event helpers and integrate tracking into:
- Context: 6 events (document create/delete/pin, space create/delete, AI generated)
- SkillTree: 3 events (skill create/delete with branch, XP added with level-up)
- Planta: 4 events (plant analyzed/created/deleted, plant watered)
- Questions: 5 events (question create/delete, research started, collection create/delete)

Updates ManaScore analytics from 3/5 to 4/5 for all four apps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-03-25 10:13:05 +01:00
parent 623ce1f051
commit 12b3c4f0f3
14 changed files with 75 additions and 4 deletions

View file

@ -275,6 +275,49 @@ export const ManaCoreEvents = {
profileUpdated: () => trackEvent('profile_updated'),
};
/**
* Context App Events
*/
export const ContextEvents = {
documentCreated: (type: string) => trackEvent('document_created', { type }),
documentDeleted: () => trackEvent('document_deleted'),
documentPinned: (pinned: boolean) => trackEvent('document_pinned', { pinned }),
spaceCreated: () => trackEvent('space_created'),
spaceDeleted: () => trackEvent('space_deleted'),
aiGenerated: () => trackEvent('ai_generated'),
};
/**
* SkillTree App Events
*/
export const SkillTreeEvents = {
skillCreated: (branch: string) => trackEvent('skill_created', { branch }),
skillDeleted: () => trackEvent('skill_deleted'),
xpAdded: (xp: number, leveledUp: boolean) =>
trackEvent('xp_added', { xp, leveled_up: leveledUp }),
};
/**
* Planta App Events
*/
export const PlantaEvents = {
plantAnalyzed: () => trackEvent('plant_analyzed'),
plantCreated: () => trackEvent('plant_created'),
plantDeleted: () => trackEvent('plant_deleted'),
plantWatered: () => trackEvent('plant_watered'),
};
/**
* Questions App Events
*/
export const QuestionsEvents = {
questionCreated: (depth: string) => trackEvent('question_created', { depth }),
questionDeleted: () => trackEvent('question_deleted'),
researchStarted: (depth: string) => trackEvent('research_started', { depth }),
collectionCreated: () => trackEvent('collection_created'),
collectionDeleted: () => trackEvent('collection_deleted'),
};
/**
* Photos App Events
*/