You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every tracked interaction (page view, menu item view, custom event) is persisted as an AnalyticsEvent row. The analytics service queries this table to produce time-series and aggregate data for the admin dashboard.
Labels:
backenddatabaseanalyticsArea:
backend/src/modules/analytics/analytics-event.entity.tsDifficulty: Intermediate
Description
Every tracked interaction (page view, menu item view, custom event) is persisted as an
AnalyticsEventrow. The analytics service queries this table to produce time-series and aggregate data for the admin dashboard.Acceptance Criteria
backend/src/modules/analytics/analytics-event.entity.ts@Entity("analytics_events")EventTypeenum exported from same file:PAGE_VIEW = "page_view",MENU_VIEW = "menu_view",CONTACT_SUBMIT = "contact_submit",CART_ADD = "cart_add",ORDER_COMPLETE = "order_complete",QR_SCAN = "qr_scan"id(UUID, primary, generated),eventType(enumEventType),page(varchar 255, nullable),itemId(UUID, nullable — references menu item),metadata(jsonb, nullable — arbitrary event data),restaurantId(UUID),sessionId(varchar 100, nullable),createdAt(CreateDateColumn)(restaurantId, eventType, createdAt)— the primary query pattern for analytics aggregation(restaurantId, itemId)for per-item analytics