@withpotter/platform-analytics — module reference
HTTP routes this module mounts, plus its internal use-cases, entities, and repositories. The exhaustive request/response contract is the engine’s OpenAPI document at /docs; the layered structure below follows the package internal architecture.
HTTP routes
Analytics /analytics
| Method | Path | Auth | Description |
|---|---|---|---|
POST | /analytics/event | — | Track analytics event |
Internals
Use-cases
Application operations. Each is a single-purpose class with one execute() method.
| Use-case | Signature |
|---|---|
TrackEventUseCase | execute(dto: TrackEventDto, ip?: string): Promise<{ success: boolean }> |
Entities
Sequelize models owned by this module.
PlatformAnalytics — table platform_analytics
| Field | Type |
|---|---|
id | string |
type | PlatformEventType |
page | string |
referrer | string | null |
duration | number | null |
scrollDepth | number | null |
sessionId | string | null |
utmSource | string | null |
utmMedium | string | null |
utmCampaign | string | null |
utmContent | string | null |
utmTerm | string | null |
userAgent | string | null |
ipHash | string | null |
createdAt | Date |
Repositories
Data-access classes wrapping the entities.
PlatformAnalyticsRepository
create · getPageViews · getUniqueVisitors · getAverageSessionDuration
Generated from the module’s source. Routes are relative to the engine root
(default http://localhost:3001). For full request/response schemas use the live
OpenAPI document.