Zum Hauptinhalt springen

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

BausteinPfad
Typen (inkl. Zonen)apps/dashboard/src/lib/analytics/footfall/types.ts
Mock / Platzhaltermock-footfall-data.ts
Env + Live-Stubintegration.tsfetchLiveFootfall
Partner → Payloadmap-partner-response.ts
API-Routeapps/dashboard/src/app/api/analytics/footfall/route.ts
UI-StatusFootfallIntegrationStatusAlert 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

  1. Response-Typ in PartnerFootfallRawResponse (map-partner-response.ts) anpassen.
  2. fetchLiveFootfallHttp in integration.ts implementieren:
    • centerId → externes Center-ID (später optional DB-Feld footfallExternalId, nur additive Migration).
    • HTTP GET/POST gemäß Spec.
    • mapPartnerFootfallToPayload(center, raw) aufrufen.
  3. Route liefert automatisch source: "live", liveDataAvailable: true.
  4. Optional: zones[] für Bereichsanalyse (Haupteingang, Food Court) – UI-Tabelle kann später an data.zones anbinden.

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.ts zeigen Portfolio-Demo.
  • Echtes Center ohne Demo-Zeile: leeres Payload (today: 0, leere hourlyToday).

Verwandt

Nutzungsstatistik: Seitenaufrufe werden anonymisiert erfasst. Im Umami-Dashboard nach diesem Pfad filtern: /developer-guide/footfall-integration-prep