Skip to content

Funnels

Funnels are a powerful analytical tool that help you understand how users progress through a sequence of actions in your application. They provide insights into where users drop off in multi-step processes and help identify opportunities for optimization.

Funnel Query Language

Basic Syntax

The funnel query language consists of several key components:

Pattern Matching

Define sequences using the match keyword and >> operator:

sql
match Login >> Search >> Purchase

Optional steps can be enclosed in square brackets:

sql
match Login >> [Search] >> Purchase
Path Definition

Define alternative paths using parentheses and the | operator:

sql
match Login >> (SearchMain | SearchCategory) >> Purchase

Domain Declaration

Used to define the set of events that can be used in funnel analysis. By default, anything that's mentioned in the match part of the query is added to the domain (and cannnot be removed). Any event that's added to domain and not referenced will be only used to stop the sequence. Basic domain syntax:

sql
domain Login, Search, Purchase

You can also create event derivatives with conditions and add alias that will be referenced in the pattern:

sql
domain Login, 
       Search where location = 'main screen' as SearchMain,
       Purchase

Time Horizon

Time horizon allows you to analyze how conversion rates and patterns change based on when users started their journey. When analyzing user behavior evolution over time, it is very important to set the same standard for measurment. It is not "fair" to measure conversion of today's cohort with the one that had days to convert. The solution is to allow everyone the same time window starting from the trigger event.

Specify a time horizon using the within keyword, default is 24 h.

sql
match Login >> Search >> Purchase
within 7 days

Variables and Properties

Each step provides access to:

  • Step.name: Event name
  • Step.repetition: Order in group
  • Step.repetitions: Total in group
  • Step.gap: Time between events

Access specific occurrences using array-like syntax:

sql
Step1[1]      // First occurrence
Step1[end]    // Last occurrence
Step1[-1]     // Last occurrence (alternative syntax)

Setting Variables

Use the set keyword to define custom metrics:

sql
set Step2.gap = Step2[1].time - Step1[end].time

Filtering

Apply conditions between steps:

sql
filter Step2.session_id = Step1.session_id

Types of Funnels

Standard Funnel

The most basic form tracks linear progression through steps:

sql
domain Login, Search, AddToCart, Purchase
match Login >> Search >> AddToCart >> Purchase

Example output:

Step       Users    Conversion
Login      1000     100%
Search     750      75%
AddToCart  400      40%
Purchase   200      20%

Time-Domain Funnel

Analyzes temporal aspects of user progression:

sql
domain Login, Search, Purchase
match Login >> Search >> Purchase
set Step2.gap = Step2[1].time - Step1[end].time
set Step3.gap = Step3[1].time - Step2[end].time

This creates a scatter plot visualization where:

  • X-axis: Average time between steps
  • Y-axis: Conversion rate at each step
  • Point size: Number of users at each step

Example visualization:

Conversion %
    ^
100 |x (Login)
    | x (Search, avg: 2.5min)
 50 |             x (Purchase, avg: 15min)
    |
  0 +-------------------------> Time
    0   5   10   15   20   min

Causal Funnel

Measures step impact on future behavior:

sql
domain Login, Feature1, Feature2, Feature3
match Login >> Feature1 >> Feature2 >> Feature3
set Step1.retention = users_returned_next_day / total_users
set Step2.retention = users_returned_next_day / total_users
set Step3.retention = users_returned_next_day / total_users

Example output:

Step      Users    Next-Day Retention
Login     1000     40%
Feature1  750      55%
Feature2  400      65%
Feature3  200      75%

Best Practices

  1. Start Simple: Begin with standard funnels before adding complexity
  2. Consider Time: Always analyze time between steps to identify friction points
  3. Segment Analysis: Break down funnels by user segments, platforms, or other relevant dimensions
  4. Validate Paths: Ensure all critical user paths are included in path analysis
  5. Control for Causality: When measuring impact, consider external factors and control groups

Advanced Features

Time Windows

Specify maximum time gaps between steps:

sql
match Login >> Search >> Purchase
filter Step2.gap <= 30min
filter Step3.gap <= 24h

Session Consistency

Ensure steps occur within the same session:

sql
match Login >> Search >> Purchase
filter Step2.session_id = Step1.session_id
filter Step3.session_id = Step1.session_id

Custom Metrics

Define and track custom metrics per step:

sql
set Step1.revenue = sum(order_value)
set Step1.average_items = avg(cart_items)