Funnels
Track funnel step completions with Owl.track() in the Swift SDK.
Funnels measure how users progress through a multi-step flow and where they drop off. The SDK side of funnel tracking is a single method call per step. For a broader overview of funnel concepts, analysis modes, and grouping options, see Funnels.
Tracking Steps
Call Owl.track() when a user completes a funnel step. The step name you pass must match the step_name in your funnel definition's event_filter.
Owl.track("welcome-screen")
Owl.track("create-account", attributes: ["method": "email"])
Owl.track("complete-profile")
Owl.track("first-post")Method Signature
public static func track(
_ stepName: String,
attributes: [String: String]? = nil
)| Parameter | Description |
|---|---|
stepName | The name of the funnel step. Must match the step_name in your funnel definition's event_filter. |
attributes | Optional key-value pairs for segmenting funnel analytics later (e.g., signup method, referral source). |
How It Works
Owl.track("welcome-screen") emits a funnel event that the server matches against funnel definitions by the step name.
For a funnel step with the filter {"step_name": "welcome-screen"}, the SDK call is:
Owl.track("welcome-screen")Step names must match exactly between your SDK calls and your funnel definition's event_filter.step_name values.
Example: Onboarding Funnel
Define the funnel on the server with steps that match your track() calls:
| Step | Event Filter | SDK Call |
|---|---|---|
| Welcome | {"step_name": "welcome-screen"} | Owl.track("welcome-screen") |
| Account Created | {"step_name": "create-account"} | Owl.track("create-account") |
| Profile Complete | {"step_name": "complete-profile"} | Owl.track("complete-profile") |
| First Post | {"step_name": "first-post"} | Owl.track("first-post") |
In your SwiftUI views:
struct WelcomeView: View {
var body: some View {
VStack {
Text("Welcome to the app")
Button("Get Started") {
Owl.track("welcome-screen")
navigateToSignup()
}
}
.owlScreen("Welcome")
}
}
struct SignupView: View {
func handleSignup() async {
do {
try await createAccount(email: email, password: password)
Owl.track("create-account", attributes: ["method": "email"])
navigateToProfile()
} catch {
Owl.error("Signup failed", screenName: "Signup")
}
}
}Combining with Experiments
Funnel steps automatically include any active experiment assignments. This allows you to segment funnel analytics by variant to compare conversion rates across A/B test groups.
// Assign a variant before the funnel begins
let variant = Owl.getVariant("onboarding-flow", options: ["control", "simplified"])
// All subsequent track() calls include the experiment assignment
Owl.track("welcome-screen")
Owl.track("create-account")Query funnel results grouped by experiment variant in the dashboard or CLI to see which variant converts better.
Funnel Definitions
Funnel definitions are created through the CLI or the dashboard, not through the SDK. The SDK only emits the step events. See Funnels for details on creating definitions, analysis modes (open vs closed), and query options.
