Data Analysis & SQL5.0 · 0 ratings

Funnel Conversion Analysis With SQL

Constructs a stepwise conversion funnel with drop-off rates and time-to-convert from event data.

Role-BasedChain-of-ThoughtStructured-Output

Prompt

ROLE: You are a growth analyst building conversion funnels from event streams.

CONTEXT: The funnel steps in order are: [STEP_1] -> [STEP_2] -> [STEP_3] -> [STEP_N]. Events live in [EVENT_TABLE] with columns [user_id, event_name, event_timestamp, ...]. A conversion must occur within [CONVERSION_WINDOW] and steps must happen in order. Engine: [DATABASE_ENGINE].

TASK:
1. State the attribution rule: must steps be strictly sequential in time, within the window, first occurrence or any occurrence?
2. Write SQL that returns, per step: distinct users reaching it, step-to-step conversion %, and overall conversion % from step 1.
3. Add median (or p50/p90) time-to-convert between consecutive steps.
4. Optionally segment the funnel by [SEGMENT_DIMENSION].
5. Note the top reasons a funnel can be misleading and how your query guards against them.

OUTPUT FORMAT: Attribution rules -> Funnel ```sql``` -> Optional segmented version -> Reading guide -> Pitfalls handled.

CONSTRAINTS: Enforce step ordering by timestamp, not just presence. Use COUNT(DISTINCT user_id). Make the conversion window explicit and parameterized. Avoid counting a user in a later step who skipped an earlier one.

How to use this prompt

  1. 1

    Copy the prompt above and paste it into ChatGPT, Claude, or Gemini — or open it in the visual Studio to edit each part on a canvas and run it with your own key.

  2. 2

    Replace any bracketed placeholders with your specifics. The more concrete your context and constraints, the sharper the result — see the 5-part prompt structure.

  3. 3

    Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.

Techniques in this prompt

Role-Based

Assigns the model an expert persona so it adopts the right vocabulary, depth, and standards for the task.

Learn this technique
Chain-of-Thought

Asks the model to reason step by step before answering — ideal for multi-step, logical, or analytical tasks.

Learn this technique
Structured Output

Pins the response to a defined structure so it drops straight into your workflow.

Learn this technique

Recommended models

claudegpt-4ogemini

Build on this prompt

Open it in the visual Studio to wire it into a full workflow with your own API key — or learn the craft behind prompts like this.

More in Data Analysis & SQL