Why This Matters

PostHog is the team’s all-in-one analytics hub. It gives House of Legends a single place to see how guests find shows, where they drop off in the booking flow, how payments perform, and how operators handle live events. PostHog goes beyond simple pageview counting. It captures the full customer journey — from first visit to paid booking — with enough detail to reconnect failed checkouts with the guest in the CRM. When a booking session breaks during payment, staff can watch the session replay to see exactly what happened and reach out to recover the sale.

What Gets Tracked

Visitor Activity (Browser)

The landing website captures visitor behavior in real time, including:
  • Page visits and show page views
  • Booking form interactions (inputs are visible in replays for recovery)
  • Checkout and payment steps
  • Video engagement
  • Frontend errors that might block bookings
  • Session replays for debugging and recovery
  • Network request and response payloads for diagnosing failed bookings
SurfaceSDKDefault capture
Landingposthog-js in apps/landing/lib/analytics/analytics.tsManual page, booking, form, video, frontend exception events, session replay, unmasked form inputs, and network request/response payload capture
DashboardNot initialized in runtimeExisting analytics helper calls are no-ops until dashboard PostHog is deliberately enabled

Business Events (Server)

The payment backend captures confirmed business outcomes — these are the events that marketing can trust because they come directly from the House of Legends server, not the visitor’s browser.
EventWhen It Fires
reservation createdA new booking is saved
checkout startedGuest enters the payment checkout step
payment completedPayment confirmed successful
payment failedPayment reported as failed
reservation cancelledBooking cancelled
refund processedRefund recorded against a payment
inquiry submittedGuest submits a booking inquiry
operator check-in completedStaff checks a guest in at the venue

Event Properties

Each event carries rich context for analysis. Here are the key properties available:
PropertyAvailable OnExample
Show code / show slugShow-scoped eventsJAZZ, jazz-night
Event date / timeShow-event scoped events2026-06-03, 19:30
Amount (VND)Booking, checkout, payment, cancellation1090000
Payment gatewayCheckout, payment, refundONEPAY
Booking pathReservation eventsDINNER_SHOW
Guest countReservation and cancellation4
Referral codeReferral-attributed bookingsPARTNER10
Referral partner typeReferral-attributed bookingsHOTEL, TOUR_COMPANY, CONCIERGE
Referral channelReferral-attributed bookingsQR_STICKER, INFLUENCER, BAR
Referral discount (VND)Referral-attributed bookings109000
Has referralReservation, checkout, payment eventstrue / false
Reservation referenceReservation, checkout, payment, cancellationRSV_260603_0001
Inquiry typeInquiry eventsPRIVATE_EVENT
Refund statusRefund eventsSUCCEEDED
Final payment statusRefund eventsREFUNDED
Payment statusPayment outcome eventsSUCCESS, FAILED
Checked in byOperator check-in eventsstaff

Booking Recovery

One of PostHog’s most valuable features for House of Legends is booking recovery. When a guest starts booking but the payment fails or the session breaks, the team can:
  1. Watch the session replay — See exactly what the guest typed, which page they were on, and where the flow broke.
  2. Inspect network payloads — See the actual API requests and responses to diagnose server-side issues.
  3. Match to the CRM — PostHog automatically links the session to the customer record, so staff know who to contact.
  4. Reach out directly — Use the CRM contact details to email or message the guest and help them complete their booking.
Captured booking replay data is operational recovery data. Keep PostHog access limited to staff who are allowed to inspect customer booking details.
Landing replay is configured for operational recovery visibility: unmasked inputs, request/response headers, request/response bodies, CRM customer identity, and booking analytics trace IDs. PostHog SDK-level platform safeguards may still apply before ingestion, but the landing app no longer performs project-level booking payload redaction.
LayerWhat is captured
Session replayBooking form inputs are visible because maskAllInputs=false on landing replay
Network payloadsRequest and response headers/bodies are enabled through recordHeaders=true and recordBody=true
Payload maskingThe landing app uses a pass-through maskCapturedNetworkRequestFn, so it does not strip query strings, request bodies, response bodies, or secret-like payload keys
CRM leadThe early customer lead stores honorific, name, email, phone, locale, selected event, booking path, guest count, experience type, and analytics trace IDs
PostHog identityAfter early lead capture, the browser identifies the PostHog person with CRM customer data including full name, email, phone, honorific, and locale
Reservation noteCreated reservations store PostHog session ID, PostHog distinct ID, and the local analytics session ID in the customer note

Customer Intelligence

PostHog powers a customer intelligence view that shows aggregate booking trends without exposing any individual customer’s personal data. Staff can see:
  • How many active, new, and returning customers the business has
  • The returning customer rate
  • Booking frequency patterns (one-time vs repeat bookers)
  • Revenue breakdown by show and booking type

Privacy Boundary

The intelligence service groups data internally by customer email for deduplication, but the response never returns raw email addresses, phone numbers, names, customer notes, dietary notes, tokens, or payment references. What you see is always aggregate, anonymized data.
GET /api/analytics/customer-intelligence returns aggregate customer analytics for the dashboard. Access is gated by canUseStaffRoutes (staff, admin, and superuser).

Visit Tracking

House of Legends tracks aggregate visitor counts by day and week. This provides a high-level view of website traffic trends without tracking individual visitors.
POST /api/system/visit-notification is a public endpoint that stores aggregate day/week counters. The stored columns are bucket_type, bucket_key, visit_count, created_at, and updated_at.The endpoint accepts path and referrer in the request body and reads user-agent, IP, and country from the request context for notification formatting, but those values are not persisted in the database by this endpoint.GET /api/system/visit-notification/stats returns the current aggregate counters. It is also public.

AI Support Observability

PostHog can track AI support interactions, but this is disabled by default and requires a privacy review before activation. When enabled, it would capture AI generation events for quality monitoring.
SurfaceSDKStatus
Honoposthog-nodeExplicit business events and gated server exceptions when POSTHOG_ENABLED=true
Mastra@mastra/posthogDisabled until the AI observability env gate is enabled
Do not enable POSTHOG_AI_OBSERVABILITY_CAPTURE_CONTENT until customer support transcript retention and redaction rules are approved.
NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN=phc_replace_with_project_token
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
NEXT_PUBLIC_POSTHOG_AUTOCAPTURE_ENABLED=false
NEXT_PUBLIC_POSTHOG_SESSION_REPLAY_ENABLED=true
1

Build the affected surfaces

pnpm --filter @hol/shared typecheck
pnpm --filter @hol/landing build
pnpm --filter @hol/dashboard build
pnpm --filter @hol/hono build
pnpm --filter @hol/mastra build
2

Verify frontend events

Open landing in production or a configured preview. Confirm page_view, booking events, customer identification, visible form inputs, and request/response network payloads appear. Dashboard browser analytics are not initialized yet.
3

Verify Hono business events

Create a reservation, start checkout, submit an inquiry, and perform a check-in. Confirm PostHog receives reservation created, checkout started, inquiry submitted, and operator check-in completed.
4

Verify payment events

For payment-related changes, production payment-flow verification is required by the project payment verification policy. Confirm payment completed or payment failed only after a real OnePay production flow.
5

Verify customer intelligence

Call GET /api/analytics/customer-intelligence with a staff session. Confirm the response contains aggregate counts and breakdowns but no raw email, phone, names, notes, or tokens.
6

Verify AI observability

Enable POSTHOG_AI_OBSERVABILITY_ENABLED=true only after privacy review. Confirm $ai_generation events appear, and confirm customer support input/output content appears only when POSTHOG_AI_OBSERVABILITY_CAPTURE_CONTENT=true.