With NRQL, you can use funnels to evaluate sets of related actions. The actions generally share a relationship via an identifier such as a user ID or session ID.
Why it matters
funnel functions can answer questions like, "Of the people that completed step A, how many also completed step B, and of the people that completed steps A and B, how many also completed step C?"
For example, at New Relic, we could use
funnel to track the number of users who completed these steps:
- Visited the New Relic marketing page.
- Signed up for an account.
- Created a dashboard.
Funnel query structure
Here's the structure of a simple NRQL funnel query:
FROM DATA_TYPESELECT funnel(AN_ATTRIBUTE, ACTION_A, ACTION_B)SINCE TIMEFRAME
See also a more complex funnel query example.
Funnel queries require the
funnel function, an attribute to funnel, and at least two steps:
- The first step is the anchor step, which will always represent 100% of the results.
- The second and later steps describe the number of users who have also completed additional actions. This number typically will be less than 100%. However, it could be 100% if every user who completes action (A) also completes the additional actions being queried.
Funnel query technical details
One way to use funnel queries is to calculate the rate at which multi-step, ordered sequences were completed over a given timeframe, like in the New Relic signup example. But you can also use funnels to calculate overlap between several distinct actions that don't have a sequential relationship to one another. In other words, the order of steps doesn't impact the calculations performed.
The way funnel queries compute results varies depending on the size of the data set:
- If the funnel is dealing with fewer than 256 funnel attribute values, it will calculate the value exactly.
- If it's dealing with 256 or more funnel attribute values, it applies an algorithm called MinHash to calculate approximate results for optimized performance.
This means that for large data sets, there may be occasional "false positives" at the level of individual data points. These do not interfere greatly with the accuracy of the numerical estimates provided in query results.
Here's a detailed breakdown of technical details and constraints for funnel queries.
Order of steps
The order of steps completed is not enforced and does not impact results.
You can only run funnel queries on one attribute at a time.
For funnel queries that involve 256 or more unique funnel attribute values, the results are approximate.
You can have a maximum of 10 steps within a single funnel query.
Funnel query example
This example queries the browser monitoring
PageView event and its attributes. It queries unique browser sessions that have progressed from browsing a product, to adding to cart, to checkout. Labels are included for each step, indicated by the keyword
FROM PageView SELECT funnel(session,WHERE pageUrl LIKE '%browse%' as 'Browse',WHERE pageUrl LIKE '%cart%' as 'Cart',WHERE pageUrl LIKE '%checkout%' as 'Checkout')SINCE 1 week AGO
This query returns the following:
An example NRQL funnel query that displays a count of the users who browsed for products, added them to their cart, and then started to checkout.
Include additional actions inside the parentheses of the funnel function in a comma separated list:
SELECT funnel(session,WHERE name = 'Controller/about/main' AS 'Action A',WHERE name = 'Controller/about/careers' AS 'Action B',WHERE name = 'Controller/about/insights' AS 'Action C',WHERE name = 'Controller/about/apply' AS 'Action D')FROM PageViewSINCE 1 week ago