Footfall-API: Vorbereitung (Live-Anbindung)
Das Dashboard lädt Footfall über GET /api/analytics/footfall?centerId=<uuid>.
Bis die Partner-API spezifiziert ist, liefert die Route source: "mock" oder leere Platzhalter – ohne erfundene Live-Zahlen.
Bereits im Code
| Baustein | Pfad |
|---|---|
| Typen (inkl. Zonen) | apps/dashboard/src/lib/analytics/footfall/types.ts |
| Mock / Platzhalter | mock-footfall-data.ts |
| Env + Live-Stub | integration.ts → fetchLiveFootfall |
| Partner → Payload | map-partner-response.ts |
| API-Route | apps/dashboard/src/app/api/analytics/footfall/route.ts |
| UI-Status | FootfallIntegrationStatusAlert auf /dashboard/analytics/footfall |
Env (Server, optional)
FOOTFALL_PROVIDER=none # später: http
FOOTFALL_API_BASE_URL= # Basis-URL des Anbieters
FOOTFALL_API_KEY= # API-Key / Token
FOOTFALL_API_TIMEOUT_MS=15000
Die Route setzt integration in der JSON-Antwort (Provider, ob URL/Key gesetzt, Hinweistext).
Wenn die API-Spec da ist
- Response-Typ in
PartnerFootfallRawResponse(map-partner-response.ts) anpassen. fetchLiveFootfallHttpinintegration.tsimplementieren:centerId→ externes Center-ID (später optional DB-FeldfootfallExternalId, nur additive Migration).- HTTP GET/POST gemäß Spec.
mapPartnerFootfallToPayload(center, raw)aufrufen.
- Route liefert automatisch
source: "live",liveDataAvailable: true. - Optional:
zones[]für Bereichsanalyse (Haupteingang, Food Court) – UI-Tabelle kann später andata.zonesanbinden.
Zonen (Bereiche)
FootfallApiPayload.zones ist optional:
{ zoneId, name, visitors, dwellMinutes?, conversionPercent? }
Kein Breaking Change für bestehende Clients.
Center-Mapping (später, DB)
Expand-only Vorschlag (noch nicht migriert):
ShoppingCenter.footfallProvider(nullable)ShoppingCenter.footfallExternalId(nullable)
Bis dahin: globales Env oder hardcoded Mapping in integration.ts.
Test ohne Live-API
- Demo-UUIDs in
mock-footfall-data.tszeigen Portfolio-Demo. - Echtes Center ohne Demo-Zeile: leeres Payload (
today: 0, leerehourlyToday).
Verwandt
Nutzungsstatistik: Seitenaufrufe werden anonymisiert erfasst. Im Umami-Dashboard nach diesem Pfad filtern: /developer-guide/footfall-integration-prep