58 lines
1.4 KiB
Markdown
58 lines
1.4 KiB
Markdown
# analytics
|
|
|
|
Analytics tracking for lilith-platform.live.
|
|
|
|
## Package Reference
|
|
|
|
This feature uses `@lilith/analytics-client` (published on Verdaccio) rather than
|
|
copying the full platform-analytics feature from lilith-platform.
|
|
|
|
The full analytics feature in lilith-platform (`codebase/features/platform-analytics/`)
|
|
includes a 16-route provider dashboard, A/B testing, cost tracking, and revenue reporting.
|
|
That infrastructure is not appropriate for the .live landing platform.
|
|
|
|
## Usage
|
|
|
|
Install the published client package:
|
|
|
|
```json
|
|
{
|
|
"dependencies": {
|
|
"@lilith/analytics-client": "^1.0.2"
|
|
}
|
|
}
|
|
```
|
|
|
|
### Page view tracking
|
|
|
|
```tsx
|
|
import { usePageViewTracking } from '@lilith/analytics-client/react'
|
|
|
|
function AppRoutes() {
|
|
usePageViewTracking()
|
|
return <Routes>...</Routes>
|
|
}
|
|
```
|
|
|
|
### Analytics provider (wraps app root)
|
|
|
|
```tsx
|
|
import { AnalyticsProvider } from '@lilith/analytics-client/react'
|
|
|
|
function App() {
|
|
return (
|
|
<AnalyticsProvider>
|
|
<AppRoutes />
|
|
</AnalyticsProvider>
|
|
)
|
|
}
|
|
```
|
|
|
|
## When to graduate to full analytics
|
|
|
|
When lilith-platform.live needs its own analytics dashboard, copy
|
|
`codebase/features/platform-analytics/backend-api/` from lilith-platform
|
|
and adapt the `analytics-gateway` module (the ingest endpoint).
|
|
|
|
The `external-platform-analytics` module handles third-party event ingestion
|
|
(separate from the provider dashboard routes).
|