Goal Sessions
rybbit_get_goal_sessionsRetrieve sessions that completed a specific goal to analyze user behavior and identify conversion patterns. Filter by date, timezone, and user attributes for targeted insights.
Instructions
Get sessions that completed a specific goal. Useful for analyzing which users and sessions triggered goal conversions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| siteId | Yes | Site ID (numeric ID or domain identifier) | |
| goalId | Yes | Goal ID to get sessions for. Use rybbit_list_goals to find goal IDs. | |
| 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 | |
| page | No | Page number, 1-indexed (default: 1) | |
| limit | No | Results per page (default: 20-50 depending on endpoint, max 200) |
Implementation Reference
- src/tools/goals.ts:139-175 (handler)The handler function for the `rybbit_get_goal_sessions` tool, which fetches sessions for a specific goal from the Rybbit API.
async (args) => { try { const { siteId, goalId, ...rest } = args as { siteId: string; goalId: string; startDate?: string; endDate?: string; timeZone?: string; filters?: Array<{ parameter: string; type: string; value: (string | number)[]; }>; pastMinutesStart?: number; pastMinutesEnd?: number; page?: number; limit?: number; }; const params = client.buildAnalyticsParams(rest); const data = await client.get( `/sites/${siteId}/goals/${goalId}/sessions`, 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/goals.ts:96-138 (registration)The registration and schema definition for the `rybbit_get_goal_sessions` tool.
"rybbit_get_goal_sessions", { title: "Goal Sessions", description: "Get sessions that completed a specific goal. Useful for analyzing which users and sessions triggered goal conversions.", annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true, destructiveHint: false, }, inputSchema: { siteId: siteIdSchema, goalId: z .string() .describe("Goal ID to get sessions for. Use rybbit_list_goals to find goal IDs."), 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"), ...paginationSchema, }, },