refactor(analytics): abstract analytics into provider pattern
Build and Deploy / build (push) Has been cancelled

- Add type-safe AnalyticsEvent union types
- Create AnalyticsProvider interface for pluggable analytics backends
- Implement OpenPanelProvider and RybbitProvider adapters
- Create AnalyticsTracker that fans out events to all providers
- Simplifies adding new analytics platforms in the future
This commit is contained in:
Unchained
2026-03-31 07:45:21 +02:00
parent bce2d19ca3
commit 66829aeffd
6 changed files with 512 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
export { AnalyticsTracker, getTracker } from "./core/AnalyticsTracker";
export type { AnalyticsEvent, AnalyticsProvider, ProductData, CartData, OrderData, UserData } from "./core/types";
export { OpenPanelProvider } from "./providers/OpenPanelProvider";
export { RybbitProvider } from "./providers/RybbitProvider";
export { useAnalytics } from "./hooks/useAnalytics";