Funnel Analysis: Measuring Conversion Step by Step

Funnel analysis step by step on 12,330 real shopping sessions: defining the steps, calculating step-by-step and overall conversion, finding where most visitors drop out, catching a stage definition that silently lost a fifth of purchases, understanding open and closed funnels, and comparing new and returning visitors.

GloryTecks Team

Training & Placement Faculty

6 May 2026 6 min read

Last updated: 25 September 2026

Share:

A funnel is a sequence of steps users take towards a goal: landing on a site, viewing a product, adding it to the cart, paying. Funnel analysis measures how many people reach each step and where they drop out, which tells a team where improvement would pay most. Analytics tools such as Google Analytics describe funnel exploration in exactly those terms: visualising the steps users take to complete a task and how well they succeed at each (Google Analytics: funnel exploration).

This guide builds a funnel from real data: 12,330 sessions on an online shop, each from a different user over a year, with the pages viewed and whether the session ended in a purchase (UCI: Online Shoppers Purchasing Intention). The dataset records a Page Value for each session, the average value of the pages visited before an e-commerce transaction, which serves as a signal that the visitor reached pages that typically precede buying.

Step 1: Define the steps, and check that they nest

Four steps: any session, viewed at least one product page, reached a page that typically precedes purchases (Page Value above zero), and purchased. Before building the funnel, check that every purchase actually passed through the earlier steps:

python
import io
import urllib.request
import zipfile
import pandas as pd

url = "https://archive.ics.uci.edu/static/public/468/online+shoppers+purchasing+intention+dataset.zip"
sessions = pd.read_csv(zipfile.ZipFile(io.BytesIO(urllib.request.urlopen(url).read())).open("online_shoppers_intention.csv"))
stages = {
    "1 session": pd.Series(True, index=sessions.index),
    "2 viewed a product page": sessions["ProductRelated"] > 0,
    "3 reached a page that precedes purchases": sessions["PageValues"] > 0,
    "4 purchased": sessions["Revenue"],
}
reached = pd.DataFrame(stages)
print("purchases without stage 3:", int((reached["4 purchased"] & ~reached["3 reached a page that precedes purchases"]).sum()),
      "of", int(reached["4 purchased"].sum()))
text
purchases without stage 3: 370 of 1908

This check matters. 370 of the 1,908 purchasing sessions show no Page Value, so a funnel that requires stage 3 before stage 4 will count only 1,538 purchases and understate conversion by a fifth. The cause is the data, not the users: these sessions are summaries, not ordered event logs, and the Page Value proxy does not capture every path to purchase. With event data, you would check the same thing by confirming that each user's events occur in the funnel's order. Either way, report how many conversions the funnel definition excludes.

Step 2: Step and overall conversion

Counting sessions that reached each step and all the steps before it gives a strict funnel:

python
funnel = pd.DataFrame({"sessions": reached.cumprod(axis=1).sum()})
funnel["from previous step"] = funnel["sessions"] / funnel["sessions"].shift()
funnel["from start"] = funnel["sessions"] / funnel["sessions"].iloc[0]
print(funnel.round(3).to_string())
text
                                          sessions  from previous step  from start
1 session                                    12330                 NaN       1.000
2 viewed a product page                      12292               0.997       0.997
3 reached a page that precedes purchases      2730               0.222       0.221
4 purchased                                   1538               0.563       0.125

Two rates tell different stories. The step conversion, from the previous step, shows where the biggest drop is: almost everyone views a product, but only 22% of product viewers reach a pre-purchase page. Once there, 56% buy. The overall conversion, from the start, shows the funnel's total output: 12.5% of sessions under this strict definition, or 15.5% counting all 1,908 purchases. The largest drop, from browsing products to getting close to buying, is where improvements to product pages, prices or calls to action would have the most room to act.

Step 3: Compare segments

The same funnel by visitor type:

python
def step_rates(group):
    r = reached.loc[group.index].cumprod(axis=1).sum()
    return pd.Series({"sessions": r.iloc[0], "to stage 3": r.iloc[2] / r.iloc[1], "stage 3 to purchase": r.iloc[3] / r.iloc[2],
                      "overall": r.iloc[3] / r.iloc[0]})
print(sessions.groupby("VisitorType").apply(step_rates, include_groups=False).round(3).to_string())
text
                   sessions  to stage 3  stage 3 to purchase  overall
VisitorType                                                          
New_Visitor          1694.0       0.226                0.864    0.194
Other                  85.0       0.188                0.875    0.165
Returning_Visitor   10551.0       0.222                0.512    0.113

New and returning visitors reach the pre-purchase pages at almost the same rate, 22.6% and 22.2%. After that they diverge: 86% of new visitors who get there buy, against 51% of returning visitors. The data cannot say why, but it points to the right question. Returning visitors may be checking prices, reviewing past orders or comparing options, and understanding their behaviour at that step is where a product or marketing team should look next. The "Other" group has only 85 sessions, too few to draw conclusions.

Open and closed funnels

Tools distinguish two ways of counting. In a closed funnel, users must enter at the first step; in an open funnel, they can enter at any step (Google Analytics: funnel exploration). A closed funnel answers "of people who started the journey, how many finished?". An open funnel also counts people who arrive directly at a later step, such as a returning customer who goes straight to the cart. Choose the one that matches the question, and state it: the two can give very different conversion rates.

Choices that change the numbers

  • Unit of analysis: sessions, as here, or users across several sessions. A user who browses on Monday and buys on Friday converts as a user but not as a session.
  • Conversion window: how long a user has to complete the funnel. Product analytics tools such as Mixpanel build funnels from ordered sequences of events within such windows (Mixpanel: funnels).
  • Step order: strict order, or any order.
  • Step definitions: the exact event or page that counts, written down so the funnel is reproducible.

From numbers to action

  1. Find the biggest drop in step conversion, weighted by how many users it affects.
  2. Segment it by device, channel, visitor type or product category to see where it is worst.
  3. Form hypotheses about causes and look at supporting evidence, such as page speed or error rates.
  4. Test changes with a controlled experiment; A/B testing for data scientists covers how.
  5. Monitor the funnel after changes, and watch the steps after the one you improved: gains early in a funnel sometimes bring in less committed users who drop out later.

Funnels answer where people drop out; cohort analysis answers whether they come back, and customer segmentation answers who they are. Product analytics 101 connects the three.

What is a good conversion rate?

It depends heavily on the industry, product, traffic source and definition. Compare against your own history and between segments rather than against general benchmarks.

Should I analyse funnels by session or by user?

By user when purchases often happen over several visits, by session when each visit is a complete journey. Many teams report both.

Why does my funnel show more conversions at a later step than an earlier one?

Usually because it is an open funnel, users skipped a tracked step, or tracking is missing on a step. Check the step definitions and the tracking before interpreting the numbers.

How many steps should a funnel have?

Enough to locate problems, usually three to six. Too many steps make each stage small and noisy; too few hide where users drop out.

Customer behaviour analysis and marketing campaign analytics projects are part of the Data Analytics course.

Sources

GloryTecks Team

Training & Placement Faculty

The GloryTecks faculty team mentors learners across Data Science, AI and Data Engineering, with a focus on real-time projects and placement readiness in Hyderabad.

Want to master Data Analytics?

Join GloryTecks’ expert-led Data Analytics training in Hyderabad with real-time projects and 100% placement support.

Explore course