Implementing funnel analysis
This functionality only works with data models written in JavaScript, not YAML.
For more information, check out the Data Modeling Syntax
page.
- The identity of the object moving through the funnel – e.g. user or lead
- A set of steps, through which the object moves
- The date and time of each step
- The time to convert between steps
Funnel parameters
userId
A unique key to identify the users moving through the funnel.nextStepUserId
In the situation whereuser_id changes between steps, you can pass a unique
key to join two adjacent steps. For example, if a user signs in after having
been tracked anonymously until that point in the funnel, you could use
nextStepUserId to define a funnel where users are tracked by anonymous ID on
the first step and then by an identified user ID on subsequent steps.
time
A timestamp of the event.steps
An array of steps. Each step has 2 required and 1 optional parameters:- name (required) - Name of the step. It must be unique within a funnel.
- eventsView (required) - Events table for the step. It must contain
userIdandtimefields. For example, if we have defined the userId asuser_idand time astimestamp, we need to have these fields in the table we’re selecting from. - timeToConvert (optional) - A time window during which conversion should
happen. Set it depending on your funnel logic. If this is set to
1 day, for instance, it means the funnel will include only users who made a purchase within 1 day of visiting the product page.
Joining funnels
In order to provide additional dimensions, funnels can be joined with other cubes usinguser_id at the first step of a funnel. This will always use a
many_to_one relationship, hence you should always join with the corresponding
user cube. Here, by ‘user’ we understand this to be any entity that can go
through a sequence of steps within funnel. It could be a real web user with an
auto assigned ID or a specific email sent by an email automation that goes
through a typical flow of events like ‘sent’, ‘opened’, ‘clicked’, and so on.
For example, for our PurchaseFunnel we can add a join to another funnel as
following:
Using funnels
Cube is based on multidimensional analysis Funnel-based cubes have the following structure:Measures
- conversions - Count of conversions in the funnel. The most useful when broken down by steps. It’s the classic funnel view.
- conversionsPercent - Percentage of conversions. It is useful when you want to inspect a specific step, or set of steps, and find out how a conversion has changed over time.
Dimensions
- step - Describes funnels’ steps. Use it to break down conversions or conversionsPercent by steps, or to filter for a specific step.
- time - time dimension for the funnel. Use it to filter your analysis for specific dates or to analyze how conversion changes over time.
Performance considerations
Funnel joins are extremely heavy for most modern databases and complexity grows in a non-linear way with the addition of steps. However, if the cardinality of the first event isn’t too high, very simple optimization can be applied:originalSql pre-aggregation.
It is best to use partitioned rollups to cache the
steps instead. Add one to the PurchaseFunnel cube as follows: