Ad-hoc funnel calculation
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Ad-hoc funnel request. All fields optional; defaults filled from the saved growth definition.
object
Event-name steps (>= 2 effective steps required after defaults).
Examplegenerated
{ "steps": [ "example" ], "windowHours": 1, "startDate": "2026-04-15", "endDate": "2026-04-15", "filterBy": "example", "filterValue": "example", "breakdownBy": "example", "comparePeriod": true, "analysisSubject": "example", "analysisSubjectKey": "example"}Responses
Section titled “Responses”Funnel calculation result (dynamic shape). NOTE: the funnel calculate endpoint lives in routes/analytics.ts, NOT routes/funnels.ts (funnels.ts only does CRUD on saved funnel definitions). The 200 body is one of THREE mutually exclusive shapes, selected by request body:
(a) body.comparePeriod === true -> {current, previous, change, _meta}
(b) body.breakdownBy is a valid dimension -> {breakdown[], _meta}
(c) otherwise -> the flat funnel result spread at top level {steps[], overall, _meta}
Precedence in code: comparePeriod wins over breakdownBy. breakdownBy/filterBy are normalized against a fixed dimension whitelist (utmSource | deviceType | visitorId | userId | sessionId | account); anything else -> null. Rates are percentages 0-100, NOT rounded (raw float). avgTimeToNext is in SECONDS (0 when no transitions observed). Errors (incl. “至少需要2个步骤”) return 400 {error: “计算失败”, detail: string}.
object
object
1-based step index.
Subjects reaching the NEXT step; equals enteredCount on the last step.
Percent 0-100
Percent 0-100
Average seconds from this step to the next; 0 when no transitions.
object
Percent 0-100
object
Localized zh-CN label. e.g. “访客”.
Null when the request supplied no/invalid dimension.
Null when the request supplied no/invalid dimension.
Localized zh-CN label. e.g. “访客”.
object
object
object
1-based step index.
Subjects reaching the NEXT step; equals enteredCount on the last step.
Percent 0-100
Percent 0-100
Average seconds from this step to the next; 0 when no transitions.
object
Percent 0-100
object
object
1-based step index.
Subjects reaching the NEXT step; equals enteredCount on the last step.
Percent 0-100
Percent 0-100
Average seconds from this step to the next; 0 when no transitions.
object
Percent 0-100
object
Percent change of overall conversionRate vs previous period. 0 when previous <= 0.
object
Localized zh-CN label. e.g. “访客”.
Null when the request supplied no/invalid dimension.
Null when the request supplied no/invalid dimension.
Localized zh-CN label. e.g. “访客”.
object
object
Distinct value of the breakdown dimension (never null/empty).
object
1-based step index.
Subjects reaching the NEXT step; equals enteredCount on the last step.
Percent 0-100
Percent 0-100
Average seconds from this step to the next; 0 when no transitions.
object
Percent 0-100
object
Localized zh-CN label. e.g. “访客”.
Null when the request supplied no/invalid dimension.
Null when the request supplied no/invalid dimension.
Localized zh-CN label. e.g. “访客”.
Calculation failed / invalid body.
object
Examplegenerated
{ "error": "example", "detail": "example"}