A funnel is a sequence of steps users move through, with drop-off at each step.
Funnel drop-off calculation in Python
import pandas as pd
# User journey log across funnel steps
funnel_data = [
{"step_order": 1, "step_name": "Landed Homepage", "users": 100000},
{"step_order": 2, "step_name": "Started Signup", "users": 30000},
{"step_order": 3, "step_name": "Completed Signup", "users": 18000},
{"step_order": 4, "step_name": "Verified Email", "users": 15000},
{"step_order": 5, "step_name": "Activated (First Action)", "users": 8000},
{"step_order": 6, "step_name": "Day-7 Retained", "users": 5000},
]
df_funnel = pd.DataFrame(funnel_data)
# Calculate step-to-step conversion, total conversion, and drop-off
df_funnel["step_conv_pct"] = df_funnel["users"] / df_funnel["users"].shift(1)
df_funnel["step_conv_pct"] = df_funnel["step_conv_pct"].fillna(1.0)
df_funnel["dropoff_users"] = df_funnel["users"].shift(1) - df_funnel["users"]
df_funnel["dropoff_pct"] = 1.0 - df_funnel["step_conv_pct"]
df_funnel["overall_conv_pct"] = df_funnel["users"] / df_funnel["users"].iloc[0]
print(df_funnel[["step_name", "users", "step_conv_pct", "dropoff_pct", "overall_conv_pct"]].to_string(
index=False,
formatters={
"users": "{:,}".format,
"step_conv_pct": "{:.1%}".format,
"dropoff_pct": "{:.1%}".format,
"overall_conv_pct": "{:.1%}".format,
}
))
Takeaway
Focus on steps with the highest conversion opportunity, not just the top-of-funnel drop.