Models
TenantVisit
Records each unique daily session for a visitor on a tenant’s microsite:TenantAnalytic
Aggregated daily summary per tenant:analytics sync job rolls up TenantVisit rows into TenantAnalytic records each day.
API endpoints
Track an interaction
Record a conversion
Fetch dashboard data
AnalyticsController in the tenant workspace. Returns time-series data for Recharts consumption.
Web interaction tracking
Three redirect routes inweb.php record interaction clicks before forwarding the user:
| Route | Interaction type |
|---|---|
GET /track/wa/{tenant:slug} | WhatsApp click |
GET /track/call/{tenant:slug} | Phone call click |
GET /track/maps/{tenant:slug} | Maps/location click |
throttle:60,1 middleware.
Each hit creates an Interaction model record linked to the tenant, enabling click-through analytics in the dashboard.
Analytics sync job
The analytics sync job aggregates rawTenantVisit rows into TenantAnalytic daily summaries. It runs as a queued job and can be dispatched on demand or triggered by the scheduler.
Exportable reports
Tenants can download their data as PDF or Excel exports:| Route | Output |
|---|---|
GET /workspace/reports/sales-pdf | Sales report PDF |
GET /workspace/reports/inventory-pdf | Inventory report PDF |
GET /api/v1/reports/download/{path} | Download pre-generated report (signed) |
GET /api/v1/exports/download | Download export file |
ReportReadyNotification is dispatched when the file is ready, delivered via database, mail, and broadcast channels.
Export jobs:
SalesExport— generates Excel via Laravel ExcelReportJob— generates PDF via a reporting package
Dashboard frontend
The tenant workspace dashboard renders analytics with Recharts (React charting library). Data flows:- Page load triggers
GET /analytics/data AnalyticsControllerqueriesTenantAnalyticfor the selected date range- Response is passed as Inertia props
- React renders
<LineChart>,<BarChart>, and summary stat cards using the Recharts components