Supabase Backend for Quiz Funnel Lead Capture
Architecture
- Supabase headers/columns capture quiz answers live as the user progresses (server-side)
- Data communicates with database on the backend in real-time
- Per-client data isolation
- Once lead submits, all data gets pushed in one go to GHL via API
How It Works
- User starts quiz funnel
- Each step's answer is captured server-side to Supabase (no data loss if they abandon)
- On final submit, complete lead data is pushed to GHL sub-account
- Contact is created/upserted in GHL with all quiz fields as custom fields
Custom Fields vs Notes
- Don't jam quiz answers into a note field
- Do create custom fields per niche for each quiz question
- Service type → Single option dropdown (e.g., maintenance, design, hardscaping, irrigation)
- Other fields → Text fields
- Use GHL MCP to create custom fields on the sub-account programmatically
Magic Link Onboarding
- Onboarding form uses magic links
- System already knows who the customer is (connected to GHL contact)
- Data populates as they fill it out — no data loss
Security
- Location ID and private integration token must NOT be leaked client-side
- Verify server-side handling of API credentials
- Meta pixel can be added to the funnel pages for ad tracking
GHL Integration
- Connect via location ID + private integration token
- Upserts contacts (creates or updates existing)
- Custom fields capture return field IDs for mapping
- Audit log shows create/update events for verification