1
0
mirror of https://github.com/mastodon/documentation synced 2025-04-11 22:56:17 +02:00
documentation/content/en/entities/Admin_Cohort.md
Nik Clayton 49868155b9
feat: Document datetime and date formats (#1565)
Add a new document that precisely describes the string representation of
datetime and date types.

The previous description of them as "ISO 8601 Datetime" was very
imprecise, as ISO 8601 describes many different ways of representing a
datetime and date.

Specify the datetime format precisely as the ISO 8601 profile described
in RFC 3339, and the date format precisely as the "Complete date" format
from the W3C note on date and time formats.

Adjust all the references to ISO 8601 datetimes or dates to link back
to the definition.

Fixes #1420
2024-11-27 15:08:51 +00:00

3.0 KiB

title description menu aliases
Admin::Cohort Represents a retention metric.
docs
parent
entities
/entities/admin-cohort
/entities/Admin-Cohort
/entities/admin_cohort
/entities/Admin_Cohort
/api/entities/admin-cohort
/api/entities/Admin-Cohort
/api/entities/admin_cohort
/api/entities/Admin_Cohort

Example

Monthly retention data for the month of 2022-09, given that 2 users registered during 2022-09 and were active at least once during that month.

{
	"period": "2022-09-01T00:00:00+00:00",
	"frequency": "month",
	"data": [
		{
			"date": "2022-09-01T00:00:00+00:00",
			"rate": 1.0,
			"value": "2"
		}
	]
}

Daily retention data for the week between 2022-09-08 and 2022-09-14, given that 2 users registered on 2022-09-08 and 1 of those users stopped being active after 2022-09-09.

{
	"period": "2022-09-08T00:00:00+00:00",
	"frequency": "day",
	"data": [
		{
			"date": "2022-09-08T00:00:00+00:00",
			"rate": 1.0,
			"value": "2"
		},
		{
			"date": "2022-09-09T00:00:00+00:00",
			"rate": 1.0,
			"value": "2"
		},
		{
			"date": "2022-09-10T00:00:00+00:00",
			"rate": 0.5,
			"value": "1"
		},
		{
			"date": "2022-09-11T00:00:00+00:00",
			"rate": 0.5,
			"value": "1"
		},
		{
			"date": "2022-09-12T00:00:00+00:00",
			"rate": 0.5,
			"value": "1"
		},
		{
			"date": "2022-09-13T00:00:00+00:00",
			"rate": 0.5,
			"value": "1"
		},
		{
			"date": "2022-09-14T00:00:00+00:00",
			"rate": 0.5,
			"value": "1"
		}
	]
}

Attributes

period

Description: The timestamp for the start of the period, at midnight.
Type: String (Datetime)
Version history:
3.5.0 - added

frequency

Description: The size of the bucket for the returned data.
Type: String (Enumerable oneOf)
day = Daily buckets
month = Monthly buckets
Version history:
3.5.0 - added

data

Description: Retention data for users who registered during the given period.
Type: Array of CohortData
Version history:
3.5.0 - added

CohortData entity attributes

date

Description: The timestamp for the start of the bucket, at midnight.
Type: String (Datetime)
Version history:
3.5.0 - added

rate

Description: The percentage rate of users who registered in the specified period and were active for the given date bucket.
Type: Number
Version history:
3.5.0 - added

value

Description: How many users registered in the specified period and were active for the given date bucket.
Type: Integer
Version history:
3.5.0 - added

See also

{{< page-relref ref="methods/admin/retention" caption="admin/retention API methods" >}}

{{< caption-link url="https://github.com/mastodon/mastodon/blob/main/app/serializers/rest/admin/cohort_serializer.rb" caption="app/serializers/rest/admin/cohort_serializer.rb" >}}