# Funnels & conversion events

> Define clean snake_case milestone events, measure multi-step sign-up and checkout funnels, diagnose drop-offs, and keep product tracking privacy-aware.

- Canonical: https://exaspark.ai/docs/custom-events-and-funnels/

## Moving beyond page views to milestone funnels

Built-in telemetry in [Analytics & live health](https://exaspark.ai/docs/analytics/) tracks traffic, speed, sign-ins, API latency, and uptime from deploy one. Page views show who arrived, but they cannot reveal where users stall inside an onboarding wizard, booking calendar, or pricing drawer.

Milestone events turn raw traffic into a clear conversion funnel. Tracking a compact set of key actions from first click to verified Stripe payment pinpoints the exact friction point costing you customers.

## Designing a clean snake_case event taxonomy

Analytics break down fast when screens emit inconsistent names like `ClickedBuy`, `signup-complete`, and `UserPaid`. Lock a strict lowercase `snake_case` convention (`object_action`) before wiring your first event:

- **Use lowercase `snake_case` strictly.** Underscores only (`checkout_started`) prevent charts and queries from splitting one action across multiple spellings.
- **Write milestones in past tense.** Pair a noun with a past-tense verb (`account_created`, `onboarding_completed`, `purchase_completed`) for unambiguous event logs.
- **Pair client intent with server truth.** Track UI clicks in the browser, but fire commercial milestones like `account_created` and `purchase_completed` strictly on the server so ad blockers or closed tabs never lose revenue data.

### Starter seven-event product funnel

Most SaaS products, booking apps, and stores only need seven milestone events to diagnose every major conversion leak:

| Event name | Fire layer | Key properties | Question answered |
| --- | --- | --- | --- |
| `landing_cta_clicked` | Client UI | `route`, `cta_slot`, `device_type` | Does your hero promise earn action? |
| `signup_started` | Client UI | `auth_method`, `entry_route` | Do visitors reach the registration form? |
| `account_created` | Server | `auth_provider`, `role`, `utm_source` | How many starts become real accounts? |
| `onboarding_completed` | Server | `steps_completed`, `duration_sec` | Do new users finish initial setup? |
| `feature_activated` | Server | `action_type`, `item_count` | Did users experience core product value? |
| `checkout_started` | Server | `plan_tier`, `billing_cycle`, `currency` | Are active users selecting a paid plan? |
| `purchase_completed` | Server (Stripe webhook) | `plan_tier`, `amount_cents`, `currency`, `is_first_order` | How many checkouts settle in Stripe? |

Keep event payloads structured, lean, and completely free of personal identifiers:

```json
{
  "event": "purchase_completed",
  "occurred_at": "2026-05-14T16:42:10Z",
  "session_id": "ses_81a9f0c2",
  "user_id": "usr_44b21d9e",
  "environment": "live",
  "properties": {
    "plan_tier": "pro_monthly",
    "billing_cycle": "monthly",
    "amount_cents": 2500,
    "currency": "usd",
    "is_first_order": true,
    "device_type": "mobile"
  }
}
```

## Building and verifying your funnel in five steps

Build and verify milestone tracking in **Preview** so test clicks never distort your production numbers.

1. **Map four to six critical steps** — Chart the path from landing to paid value; skip noisy hovers and minor UI clicks.
2. **Freeze your snake_case catalog** — Finalize exact event names, server vs client firing layers, and allowed properties upfront.
3. **Wire tracking in Preview** — Store milestone rows in your database with typed validation and indexes on `event`, `user_id`, and `occurred_at`.
4. **Walk the journey as a fresh test user** — Complete sign-up, onboarding, and a Stripe Test checkout in **Preview** to verify every event fires once.
5. **Publish and gather real baseline volume** — Click **Publish** and collect at least 100 sessions per step before acting on conversion ratios.

> **Example prompt (App):** Add structured milestone funnel tracking using lowercase snake_case events: landing_cta_clicked and signup_started on the client, plus server-verified account_created, onboarding_completed, checkout_started, and purchase_completed (recorded strictly from the verified Stripe webhook). Store events in an app_events table indexed on event and occurred_at with opaque user_id only (no PII), and build an admin-only Funnels tab showing step conversion rates filterable by 7d, 30d, and device type.

Because **Preview** and **Live** use separate databases, QA runs never pollute Live funnels. See [Preview vs Live](https://exaspark.ai/docs/preview-vs-live/).

## Reading funnel drop-off and finding the real bottleneck

Optimizing checkout barely helps if two-thirds of prospects vanish during sign-up. Always fix the largest percentage drop nearest the top of your funnel first.

| Steepest drop-off | Likely root cause | Fix to test in Preview |
| --- | --- | --- |
| **`landing_cta_clicked` -> `signup_started`** | Slow route load or unexpected login wall | Speed up transition and preview value before gating |
| **`signup_started` -> `account_created`** | Long form or missing social sign-in | Keep fields minimal and add Google login via [Authentication & roles](https://exaspark.ai/docs/authentication-and-roles/) |
| **`account_created` -> `onboarding_completed`** | Blank dashboard or tedious questionnaire | Replace long forms with a fast 2-step setup and starter template |
| **`onboarding_completed` -> `feature_activated`** | Unclear next action after setup | Redirect straight into the user's first core action |
| **`checkout_started` -> `purchase_completed`** | Hidden fees or mobile form friction | Show total price upfront and verify mobile checkout in [Browser Device Lab](https://exaspark.ai/docs/device-lab/) |

### Segmenting funnels by device and traffic source

Blended averages conceal broken flows. An `8%` overall conversion rate can hide `14%` on desktop beside a broken `1.2%` mobile Safari button. Segment every funnel by **mobile vs desktop**, **new vs returning users**, and **traffic source** — pairing cohorts on **Pro** with [ROAS & Stripe attribution](https://exaspark.ai/docs/roas-and-stripe-attribution/).

## Keeping event tracking privacy-aware and compliant

Strong measurement never requires storing raw personal data inside analytics logs. Build four privacy defaults into every app:

- **Exclude raw PII from event properties.** Never log emails, names, phone numbers, addresses, tokens, or payment fields inside event payloads; reference opaque IDs (`user_id`, `session_id`) only.
- **Minimize collected events.** Tie every tracked milestone to a concrete product decision instead of capturing every keystroke or scroll.
- **Distinguish core commerce records from ad trackers.** Server-verified order and sign-up milestones are essential operational records, whereas optional advertising pixels follow regional consent banners and your Privacy Policy.
- **Gate funnel dashboards to admins.** Enforce server-side admin role checks on funnel queries so regular members never view aggregate business counts.

## Common tracking bugs and troubleshooting

| Tracking symptom | Root cause | Fix |
| --- | --- | --- |
| **Counts double on refresh or re-render** | Client event runs inside an unguarded effect | Trigger strictly on user actions or deduplicate via server `idempotency_key` |
| **`purchase_completed` lags behind Stripe** | Event fired on a client thank-you route | Move `purchase_completed` strictly into the server Stripe webhook handler |
| **Funnel breaks after Google sign-in** | Anonymous `session_id` dropped on redirect | Persist `session_id` in a first-party cookie and stitch to `user_id` on callback |
| **Duplicate event names appear in charts** | Mixed casing (`CheckoutStarted` vs `checkout_started`) | Enforce a typed allowlist of lowercase `snake_case` constants on the server |
| **Conversion rate looks unusually high** | Team tested directly on Live | Run QA strictly in **Preview** and exclude internal admin IDs from reports |

> **Note:** Treat every funnel tweak as a controlled experiment. Ship one focused improvement per week, wait for comparable volume, and keep only changes that lift downstream paid conversions.

## Next steps

- [Analytics & live health](https://exaspark.ai/docs/analytics/) — Pair custom conversion funnels with built-in traffic, latency, and API telemetry.
- [Landing page conversion](https://exaspark.ai/docs/landing-page-conversion/) — Strengthen top-of-funnel hero copy, social proof, and mobile CTA clarity.
- [User profiles & onboarding](https://exaspark.ai/docs/user-profiles-onboarding/) — Turn newly registered accounts into active, returning customers faster.

## From the blog

- [What is conversion tracking?](https://exaspark.ai/blog/what-is-conversion-tracking/) — Connect visitor journeys reliably from first click to completed revenue.
- [Why AI-built apps stall after launch](https://exaspark.ai/blog/why-ai-built-apps-stall-after-launch/) — Close the operational gap between shipping features and growing retention.
- [How to validate an app idea](https://exaspark.ai/blog/how-to-validate-an-app-idea/) — Use real behavioral signals instead of guesswork to guide roadmap choices.
