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
Browser SDK details
Browser SDK details
| Surface | SDK | Default capture |
|---|---|---|
| Landing | posthog-js in apps/landing/lib/analytics/analytics.ts | Manual page, booking, form, video, frontend exception events, session replay, unmasked form inputs, and network request/response payload capture |
| Dashboard | Not initialized in runtime | Existing 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.| Event | When It Fires |
|---|---|
reservation created | A new booking is saved |
checkout started | Guest enters the payment checkout step |
payment completed | Payment confirmed successful |
payment failed | Payment reported as failed |
reservation cancelled | Booking cancelled |
refund processed | Refund recorded against a payment |
inquiry submitted | Guest submits a booking inquiry |
operator check-in completed | Staff checks a guest in at the venue |
Event Properties
Each event carries rich context for analysis. Here are the key properties available:| Property | Available On | Example |
|---|---|---|
| Show code / show slug | Show-scoped events | JAZZ, jazz-night |
| Event date / time | Show-event scoped events | 2026-06-03, 19:30 |
| Amount (VND) | Booking, checkout, payment, cancellation | 1090000 |
| Payment gateway | Checkout, payment, refund | ONEPAY |
| Booking path | Reservation events | DINNER_SHOW |
| Guest count | Reservation and cancellation | 4 |
| Referral code | Referral-attributed bookings | PARTNER10 |
| Referral partner type | Referral-attributed bookings | HOTEL, TOUR_COMPANY, CONCIERGE |
| Referral channel | Referral-attributed bookings | QR_STICKER, INFLUENCER, BAR |
| Referral discount (VND) | Referral-attributed bookings | 109000 |
| Has referral | Reservation, checkout, payment events | true / false |
| Reservation reference | Reservation, checkout, payment, cancellation | RSV_260603_0001 |
| Inquiry type | Inquiry events | PRIVATE_EVENT |
| Refund status | Refund events | SUCCEEDED |
| Final payment status | Refund events | REFUNDED |
| Payment status | Payment outcome events | SUCCESS, FAILED |
| Checked in by | Operator check-in events | staff |
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:- Watch the session replay — See exactly what the guest typed, which page they were on, and where the flow broke.
- Inspect network payloads — See the actual API requests and responses to diagnose server-side issues.
- Match to the CRM — PostHog automatically links the session to the customer record, so staff know who to contact.
- Reach out directly — Use the CRM contact details to email or message the guest and help them complete their booking.
Booking recovery capture scope details
Booking recovery capture scope 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.
| Layer | What is captured |
|---|---|
| Session replay | Booking form inputs are visible because maskAllInputs=false on landing replay |
| Network payloads | Request and response headers/bodies are enabled through recordHeaders=true and recordBody=true |
| Payload masking | The landing app uses a pass-through maskCapturedNetworkRequestFn, so it does not strip query strings, request bodies, response bodies, or secret-like payload keys |
| CRM lead | The early customer lead stores honorific, name, email, phone, locale, selected event, booking path, guest count, experience type, and analytics trace IDs |
| PostHog identity | After early lead capture, the browser identifies the PostHog person with CRM customer data including full name, email, phone, honorific, and locale |
| Reservation note | Created 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.Customer intelligence endpoint details
Customer intelligence endpoint details
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.Visit notification endpoint details
Visit notification endpoint details
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.AI observability and SDK details
AI observability and SDK details
| Surface | SDK | Status |
|---|---|---|
| Hono | posthog-node | Explicit business events and gated server exceptions when POSTHOG_ENABLED=true |
| Mastra | @mastra/posthog | Disabled until the AI observability env gate is enabled |
Environment variables
Environment variables
- Landing and Dashboard
- Hono
- Mastra
Verification steps
Verification steps
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.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.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.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.