How to build a model to find the most impactful paths in user journeys

In this how-to, we’ll build a model to uncover which paths in user journeys have the biggest impact on product goals (e.g. conversion). You can use it to improve products or optimize marketing campaigns, or as a base for deeper user behavior analyses.



Sponsored Post

 
 

Not your typical funnel analysis

 
If you run a traditional funnel analysis, you predefine the steps of the funnel, and then analyze the differences for user attributes or behavior in each step.

However, just like desire paths in real life can break an arguably well-thought-out street layout, making assumptions about which flows people take in your product doesn’t always match reality.

 

How to build a model to find the most impactful paths in user journeys
A desire path carved out by its users

 

Similarly, in traditional funnel analysis, this means you may miss important, impactful paths that users actually take, e.g. because they’re not very obvious or not used much yet. 

Finding out which paths drive users towards your goals and which ones drive them away tells a much more complete story. As such, it’s valuable input for product- and marketing teams, but it can also be used as a base for further user behavior analysis.

 

Finding the paths that lead to conversion

 
Let’s have a look at how you can analyze paths that convert to your goal, and how to learn from them. For this, we’ll be using the Funnel Discovery model from Objectiv’s open model hub (our open-source data collection & modeling platform for product analytics, see the GitHub repo). 

After instantiating the model, you’ll first have to define which events you see as conversion to your product goal. In this example we use a dataset collected from Objectiv’s website, and view someone as converted when they go from the website to the documentation, but you can use any event.

# instantiate the FunnelDiscovery model from the open model hub
funnel = modelhub.get_funnel_discovery()

# define which data to use as conversion events
# in this example, anyone who goes on to read the documentation
df['is_conversion_event'] = False
df.loc[df['application'] == 'objectiv-docs', 'is_conversion_event'] = True

 

In this example, we want to limit the analysis to the paths that resulted in conversion. We’ll use a maximum of 4 steps for simplicity:

# get paths that resulted in conversion (with the `only_converted_paths` param), 
# including the step of conversion (with the `add_conversion_step_column` param)

df_steps_till_conversion = funnel.get_navigation_paths(
df, 
steps=4, 
by='user_id', 
add_conversion_step_column=True, 
only_converted_paths=True
)

df_steps_till_conversion.head(5)

 

How to build a model to find the most impactful paths in user journeys
 

To select the paths that are most interesting to analyze further, we can use a Sankey diagram. In this example we’ll filter it to conversion on the 4th step, and a maximum of 15 flows, for simplicity.

# filter down to sequences that converted on the 4th step
condition_convert_on_step_4 = df_steps_till_conversion['_first_conversion_step_number'] == 4

# plot the Sankey diagram using the top 15 examples via the `n_top_examples` param
funnel.plot_sankey_diagram(
df_steps_till_conversion[condition_convert_on_step_4], n_top_examples=15
)

 
 
In the resulting Sankey Diagram, the width of each link represents the amount of times that flow was used, and you can hover over each link to see the source and target node:

 

How to build a model to find the most impactful paths in user journeys
Sankey Diagram for paths that converted users have taken

 

You can interact with the diagram to understand the paths that lead to conversion, and decide which to analyze further directly on the full, raw dataset.

 

Another example: What makes users not convert from marketing campaigns?

 
The same analyses can be run for journeys that start from a marketing campaign, e.g. to analyze why campaigns do or do not convert.

# first, add marketing data to the dataframe
df_marketing['utm_campaign'] = df_marketing.global_contexts.gc.get_from_context_with_type_series(
type='MarketingContext', 
key='campaign'
)

# filter the dataframe down to users that came in via a marketing campaign
user_list = df_marketing[~df_marketing['utm_campaign'].isnull()].user_id
df_marketing = df_marketing[df_marketing['user_id'].isin(user_list)]

# define which data to use as conversion events; 
# in this example, anyone who goes on to read the documentation
df_marketing['is_conversion_event'] = False
df_marketing.loc[df_marketing['application'] == 'objectiv-docs', 'is_conversion_event'] = True

 

To look at just the users who did not convert, filter the data down and plot the Sankey Diagram:

# filter to non-converted users
df_marketing_non_converted = df_marketing[df_marketing['user_id'].isin(
Users_non_converted
)]
 
# get their paths 
df_steps = funnel.get_navigation_paths(
df_marketing_non_converted, 
steps=4, 
by='user_id'
)

# and plot the diagram
funnel.plot_sankey_diagram(df_steps, n_top_examples=15)

 

Which results in the following interactive Sankey diagram:

 

How to build a model to find the most impactful paths in user journeys
Sankey Diagram for paths that non-converted users have taken from a marketing campaign

 

This allows you to understand the paths that lead to users dropping off after entering from a marketing campaign, and decide on which to analyze further.

 

In conclusion

 
In a traditional funnel analysis you predefine the steps of the funnel, but making assumptions about which flows people take in your product doesn’t always match reality. We’ve shown a funnel-discovery analysis that uncovers paths that drive users towards or away from your goals, and how you can run this analysis easily using a pre-built model from Objectiv’s open model hub. You can use the results directly to inform marketing or product decisions, or go even deeper by combining it with other models. 

If you want to learn more about Objectiv or want to try it out yourself, check out the repo

 

Join the product analytics modeling community

 
If you’re interested in product analytics modeling, we recommend joining Objectiv on Slack. It’s a great place to learn & share with like-minded people in data or to get help setting up Objectiv.