We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Funnel Metrics

A funnel tracks users through a multi-step process. At each step, some users continue and some leave. Measuring where users drop off tells you where to focus your improvement efforts.

For example, on Boot.dev, the "conversion" funnel is:

  1. Visit homepage – User arrives
  2. Signup – User creates an account
  3. Submit lesson – User does their first free lesson
  4. Purchase – User buys a paid membership

Not every user completes every step. The percentage who make it from one step to the next is the conversion rate... more on that soon.

A simple loop and the pd.Series constructor can turn a few related counts into one labeled result:

channels = ["search", "social", "email"]

visitor_counts = {}
for channel in channels:
    visitors = visits[visits["source"] == channel]["visitor_id"].nunique()
    visitor_counts[channel] = visitors

traffic_series = pd.Series(visitor_counts)
print(traffic_series)
search    5000
social    1200
email      800
dtype: int64

Assignment

SnackStack's growth team wants to know where users fall out of the onboarding funnel: bring a device online, send a temperature reading, start a recipe, then purchase a recipe pack.

Complete the count_users_at_each_step function. It accepts an events DataFrame with event_name and user_id columns and an ordered funnel_steps list.