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.
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 One marketing page.
- Signed up for an account.
- Created a dashboard.
Here's the structure of a simple NRQL funnel query:
FROM DATA_TYPE SELECT funnel(AN_ATTRIBUTE, ACTION_A, ACTION_B) SINCE TIMEFRAME
See also a more complex funnel query example.
- 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.
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 One 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 256 funnel attribute values or fewer, it will calculate the value exactly.
- If it's dealing with more than 256 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 more than 256 unique funnel attribute values, the results are approximate.
You can have a maximum of 10 steps within a single funnel query.
This example queries the browser monitoring
PageView event and its attributes. It queries unique browser sessions that have progressed from registration to account upgrades. Labels are included for each step, indicated by the keyword
FROM PageView SELECT funnel(session,WHERE pageUrl='http://www.storefront.com/signup' AS 'Email Sign Up',WHERE pageUrl='http://www.appproduction.com/basic_feature' AS 'Feature Compare',WHERE pageUrl='http://www.appproduction.com/advanced_feature/upgrade' AS 'Upgraded Account')SINCE 12 hours ago
This query returns the following:
An example NRQL funnel query that displays a count of the users who registered for an account, visited a feature-compare page, and upgraded.
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