Segments and funnels
Use segments to study a selected audience and funnels to understand progress toward a goal. Both analyze behavior across events.
Examples use an existing engine and retained event history.
Choose a segment scope
| Scope | Example question |
|---|---|
| Visitors | What do people who purchased do elsewhere? |
| Sessions | What happens during visits that include the pricing page? |
| Excluded membership | How does the audience that did not sign up behave? |
A visitor segment includes considered events from matching visitor identities. A session segment includes considered events from matching sessions. An ordinary event filter only selects individual matching events.
var buyers = new AnalyticsQuery
{
Metrics = { Metric.Visitors },
Segments = { Segment.VisitorsWho("purchase") },
};
var pricingVisits = new AnalyticsQuery
{
Metrics = { Metric.Visitors },
Segments =
{
Segment.SessionsWith(
StandardEvents.PageView,
Filter.Equal(StandardDimensions.Page, "/pricing")),
},
};
var nonBuyers = new AnalyticsQuery
{
Metrics = { Metric.Visitors },
Segments = { Segment.VisitorsWho("purchase").Exclude() },
};
var report = await analytics.QueryAsync(buyers); Use one segment at a time when comparing these audiences. Adding several segments to a query requires membership in all of them.
Define the conversion path
A funnel matches required steps in order, allowing other actions between them:
var funnel = await analytics.QueryAsync(new FunnelQuery
{
Range = DateRange.LastDays(30),
Steps =
{
FunnelStep.Page("Pricing", "/pricing"),
FunnelStep.Page("Signup form", "/signup"),
FunnelStep.Goal("signup"),
},
Window = TimeSpan.FromDays(1), // null: all steps within one session
});
foreach (var step in funnel.Steps)
Console.WriteLine($"{step.Name}: {step.Visitors} ({step.ConversionRate:P0}, drop-off {step.DropOff})"); The result shows visitors reaching each step, conversion from the first step, conversion from the previous step, and drop-off.
Choose the completion window
With no Window, all steps must happen within one session. Set a positive window for behavior that can span visits within the specified duration from the first step.
Cross-day analysis requires identity that remains consistent across days. Daily anonymous rotation cannot connect the same person across those boundaries.
Place filters at the right level
A step filter applies only to that step. A global funnel filter applies to every considered event.
Put a pricing-page condition on the pricing step. Applying it globally would also exclude later events that do not carry that page, including purchases.
Compare funnels consistently
Keep the site, audience, range, identity policy, and completion window consistent across comparisons. Repeated actions from one visitor do not represent independent visitors.
Segments and funnels require retained raw events. Long-lived daily totals cannot reconstruct an ordered conversion path after its event history expires.