Funnel Analysis

This guide will cover:

Funnels are a powerful analysis type that can be used across a broad range of applications such as:

  • Determining the dropoff of users performing key actions in your app (e.g. of users who signed up last month, how many created a feed? added content? got a share?)

  • Determining the retention of users in your app (e.g. how many users who did X in this timeframe did it again in that timeframe?)

  • Advanced attribution analysis (e.g. how many users referred by campaign X ultimately became a paying customer?)

  • Advanced user targeting (e.g. get the list of users who clicked on email campaign Y and also added an item > $300 to their cart)

  • Beyond tracking user behavior, Keen funnels and queries also work on any arbitrary “actor ids” that appear in your events. You can use funnels to answer other questions like: how many of the posts created last week were viewed from mobile? viewed from web? starred? deleted? Or, for example, get the list of products that were added in May but have never been placed in a cart.

Basic Funnel Overview

In the most basic application of funnels, we want to find out how many actors fall off at each step in order to determine where a given flow loses the most users. This helps identify areas for improvement, as well as the overall health of your business.

For example, a funnel could include these steps:

  • Successful completion of an app’s tutorial
  • Creation of content in the app
  • Sharing of content with another user

A funnel analysis with those steps would work like this:

  • Count the number of unique users who completed the app’s tutorial in July.
  • Of the users who were counted in step 1, count the number of them who created content.
  • Of the users who were counted in step 2, count the number of them who shared content.

It’s important to note that Keen’s funnels do not enforce the order of the steps in the flow. In the above example, if the user created content before July, they would still show up in the count for step 3! That’s why it’s a good idea to use timeframes on every step of the funnel (plus it’s WAY faster since you don’t have to search the entire history of events).

A better way to model this funnel would be:

  • Count the number of unique users who completed the app’s tutorial in July.
  • Of the users who were counted in step 1, count the number of them who created content after July 1.
  • Of the users who were counted in step 2, count the number of them who shared content after July 1.

Example Funnel Query

Here’s an example of a funnel query built using the Keen JavaScript library. Funnels can also be used powerfully in scripting and several of the Keen libraries support funnel analysis (Ruby, Python, etc).

Here’s what that would look like using the keen-analysis.js and keen-dataviz.js libraries:

const client = new KeenAnalysis({
  projectId: KEEN_PROJECT_ID,
  readKey: KEEN_READ_KEY
});

const chart = new KeenDataviz({
  //Required:
  container: '#chart',
  type: 'funnel', //chart type
  //Optional:
  title: 'Purchases this Year',
  funnel: { // funnel chart configuration
    percents: {
      show true, // show and hide percents
    }
  }
})

client
  .query({
    analysis_type: 'funnel',
    timeframe: {
    start: "2015-07-01T07:00:00.000Z" // analyze events after this date
    },
    steps: [
      {
        event_collection: "purchases",
        actor_property: "person.id",
        filters: [
          {
            property_name : "product",
            operator : "eq",
            property_value : "telekinetic watch"
          }
        ],
        timeframe: { // limit analysis to users who purchased in this timeframe
        start: "2015-07-01T07:00:00.000Z",  
        end: "2015-08-01T07:00:00.000Z"
        }
      },
      {
        event_collection: "activations", // how many activated the device?
        actor_property: "user.id",
        optional: true
      },
      {
        event_collection: "sessions", // how many had a session?
        actor_property: "user.id",
        optional: true
      },
      {
        event_collection: "sessions",
        actor_property: "user.id",
        filters: [
            {
              property_name : "lifetime_session_count",
              operator: "gt",
              property_value : 1 // how many had more than 1 session
            }
         ],
         optional: true
      },
      {
        event_collection: "send_invitations",
        actor_property: "uuid"
      }
    ]
  })
  .then(function(res) {
    // Handle the result
    chart
     .render(res);
  })
  .catch(function(err) {
    // Handle the error
    chart
      .message(err.message);
  });

There’s More…

While we hope this introduction was helpful, we’re really just scratching the surface. Keen offers the most advanced funnel analysis, including the ability to output an array of actor IDs for each step!

Checkout these special funnel parameters that you can apply to any step:

Parameter Default Description
inverted false A boolean value that excludes events matching this step.
optional false A boolean value that instructs the funnel to ignore the effects of this step on subsequent steps.
with_actors false A boolean value that instructs the funnel to return a list of actor_property values for this step.

Next Steps

For more on funnels, check out:

Questions? Reach out to us anytime at team@keen.io or chat with us on Keen Community Slack!