With NRQL, you can use funnels to evaluate a series of related actions. A NRQL funnel allows you to ask, “Of the people that did step A, how many also did 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 funnels to track the number of users who completed these steps:
- Visited the New Relic Insights marketing page.
- Signed up for an Insights account.
- Created a dashboard.
Funnel query structure
Here's the structure of a simple NRQL funnel query:
FROM DATA_TYPE SELECT funnel(AN_ATTRIBUTE, STEP_A, STEP_B) SINCE TIMEFRAME
See 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 advance along each step towards the goal. This number typically will be less than 100%. However, it could be 100% if every user who completes (A) also completes (B).
|Order of steps||The order of steps completed is not enforced. In funnel query results, the second or third steps may have been completed by users before the first step.|
|Attributes||Funnel queries can be run on only a single attribute at a time.|
|Unique values||For funnel queries that inspect more than 256 unique values, the results are approximate, for performance optimization reasons.|
|Maximum steps||You can have a maximum of 10 steps within a funnel query.|
Funnel query example
This example queries the New Relic Browser
PageView event and its attributes. It queries unique browser sessions that have gone from registering to upgrading their account. 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:
Include additional steps inside the parentheses of the funnel function in a comma separated list:
SELECT funnel(session, WHERE name='Controller/about/main' AS 'Step A', WHERE name = 'Controller/about/careers' AS 'Step B', WHERE name = 'Controller/about/insights' AS 'Step C', WHERE name = 'Controller/about/apply' AS 'Step D') FROM PageView SINCE 1 week ago