velt-view-analytics-best-practices
Installation
SKILL.md
Velt View Analytics Best Practices
Implementation guide for the Velt View Analytics feature — a "who viewed this document today" indicator with a trigger badge, a recent-viewers dialog (desktop) and bottom sheet (mobile), and observable / hook APIs for aggregating views by user or by date.
When to Apply
Reference these guidelines when:
- Placing
<VeltViewAnalytics>(or<velt-view-analytics>) in your toolbar - Scoping to a sub-document with
type="location"+location-id - Reading unique-view counts from React (
useUniqueViewsByUser,useUniqueViewsByDatehooks) or non-React (client.getViewsElement().get*().subscribe(...)) code - Building a fully custom trigger badge / viewer list using the wireframe tags (
<velt-view-analytics-wireframe>,<velt-view-analytics-dialog-wireframe>,<velt-view-analytics-bottom-sheet-wireframe>) - Reading
componentConfig.*template variables (todayViewsCount,totalUniqueViewsCount,treadsVisible,userViews,bottomSheetMode, etc.)
For general SDK setup, see velt-setup-best-practices for VeltProvider, auth, and document identity.
Naming gotcha — getViewsElement (plural)
The element handle is client.getViewsElement() (plural) — not getViewElement (singular). Calling getViewElement() is a common hallucination from base models; it does not exist. The plural form is consistent with the hook/observable names (getUniqueViewsByUser, getUniqueViewsByDate).