Ad-hoc retention/cohort calculation
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Ad-hoc retention/cohort request. All fields optional; defaults from growth definition.
object
Responses
Section titled “Responses”Retention matrix (dynamic shape). Some keys are dynamic — Two shapes discriminated by the literal segmented boolean, which is ALWAYS present. segmented=true only when body.segmentBy resolves to a valid dimension (utmSource | deviceType | visitorId | userId | sessionId | account). matrix[].retention is a DYNAMIC-KEYED map: keys are the stringified retention intervals actually requested (body.retentionDays, default [0,1,3,7,14,30]); values are percentages 0-100 rounded to 2 decimals. Keys therefore vary per request — modeled with additionalProperties: number, which is honest here. cohortDate is a date-only string “YYYY-MM-DD” (bucket start, UTC; week buckets snap to Monday, month buckets to the 1st). Matrix is sorted cohortDate DESC. headers are localized Chinese labels: index 0 is always “D0”, others are D{n}天 / D{n}周 / D{n}月 depending on granularity — same length/order as retentionDays. Errors (“起始事件不能为空”) return 400 {error: “计算失败”, detail: string}.
object
object
Bucket start date “YYYY-MM-DD” (UTC).
Dynamic map: key = retention interval (stringified integer, matching retentionDays), value = percent 0-100 rounded to 2 decimals.
object
object
Retention interval (unit follows granularity).
Mean of the per-cohort rates for that interval; when no cohorts exist, 100 for day 0 and 0 otherwise.
object
Null when the request supplied no/invalid dimension.
object
object
Distinct value of the segment dimension.
object
Bucket start date “YYYY-MM-DD” (UTC).
Dynamic map: key = retention interval (stringified integer, matching retentionDays), value = percent 0-100 rounded to 2 decimals.
object
object
Retention interval (unit follows granularity).
Mean of the per-cohort rates for that interval; when no cohorts exist, 100 for day 0 and 0 otherwise.
object
Null when the request supplied no/invalid dimension.
Calculation failed / invalid body.
object
Examplegenerated
{ "error": "example", "detail": "example"}