Analyze Funnel
rybbit_analyze_funnelAnalyze user conversion funnels by defining custom steps (pages or events) to track visitor counts and drop-off rates across your website.
Instructions
Analyze a custom funnel by defining steps (page visits or events). Returns visitor counts and drop-off rates at each step.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| siteId | Yes | Site ID (numeric ID or domain identifier) | |
| startDate | No | Start date (YYYY-MM-DD) | |
| endDate | No | End date (YYYY-MM-DD) | |
| timeZone | No | IANA timezone (default UTC) | |
| filters | No | Filters to apply | |
| pastMinutesStart | No | Minutes ago start | |
| pastMinutesEnd | No | Minutes ago end | |
| steps | Yes | Funnel steps to analyze (minimum 2) |
Implementation Reference
- src/tools/funnels.ts:123-157 (handler)The handler function for 'rybbit_analyze_funnel' which takes funnel steps and filters, builds the analytics parameters, and POSTs to the analysis endpoint.
async (args) => { try { const { siteId, steps, ...rest } = args as { siteId: string; steps: FunnelStep[]; startDate?: string; endDate?: string; timeZone?: string; filters?: Array<{ parameter: string; type: string; value: (string | number)[]; }>; pastMinutesStart?: number; pastMinutesEnd?: number; }; const params = client.buildAnalyticsParams(rest); const data = await client.post<FunnelAnalysisResult>( `/sites/${siteId}/funnels/analyze`, { steps }, params ); return { content: [{ type: "text" as const, text: truncateResponse(data) }], }; } catch (err) { const message = err instanceof Error ? err.message : String(err); return { content: [{ type: "text" as const, text: `Error: ${message}` }], isError: true, }; } } - src/tools/funnels.ts:82-121 (schema)Input schema definition for the 'rybbit_analyze_funnel' tool, defining siteId, optional date/time range filters, and the required array of funnel steps.
inputSchema: { siteId: siteIdSchema, startDate: z .string() .optional() .describe("Start date (YYYY-MM-DD)"), endDate: z .string() .optional() .describe("End date (YYYY-MM-DD)"), timeZone: z .string() .optional() .describe("IANA timezone (default UTC)"), filters: z .array(filterSchema) .optional() .describe("Filters to apply"), pastMinutesStart: z .number() .optional() .describe("Minutes ago start"), pastMinutesEnd: z .number() .optional() .describe("Minutes ago end"), steps: z .array( z.object({ value: z.string().describe("Page path or event name"), type: z.enum(["page", "event"]).describe("Step type"), name: z .string() .optional() .describe("Display name for the step"), }) ) .min(2) .describe("Funnel steps to analyze (minimum 2)"), }, - src/tools/funnels.ts:70-122 (registration)Registration of the 'rybbit_analyze_funnel' tool on the McpServer.
server.registerTool( "rybbit_analyze_funnel", { title: "Analyze Funnel", description: "Analyze a custom funnel by defining steps (page visits or events). Returns visitor counts and drop-off rates at each step.", annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true, destructiveHint: false, }, inputSchema: { siteId: siteIdSchema, startDate: z .string() .optional() .describe("Start date (YYYY-MM-DD)"), endDate: z .string() .optional() .describe("End date (YYYY-MM-DD)"), timeZone: z .string() .optional() .describe("IANA timezone (default UTC)"), filters: z .array(filterSchema) .optional() .describe("Filters to apply"), pastMinutesStart: z .number() .optional() .describe("Minutes ago start"), pastMinutesEnd: z .number() .optional() .describe("Minutes ago end"), steps: z .array( z.object({ value: z.string().describe("Page path or event name"), type: z.enum(["page", "event"]).describe("Step type"), name: z .string() .optional() .describe("Display name for the step"), }) ) .min(2) .describe("Funnel steps to analyze (minimum 2)"), }, },