Reference documentation and code samples for the Google Analytics Data V1beta API class Google::Analytics::Data::V1beta::CohortSpec.
The specification of cohorts for a cohort report.
Cohort reports create a time series of user retention for the cohort. For
example, you could select the cohort of users that were acquired in the first
week of September and follow that cohort for the next six weeks. Selecting
the users acquired in the first week of September cohort is specified in the
cohort object. Following that cohort for the next six weeks is specified in
the cohortsRange object.
The report response could show a weekly time series where say your app has
retained 60% of this cohort after three weeks and 25% of this cohort after
six weeks. These two percentages can be calculated by the metric
cohortActiveUsers/cohortTotalUsers and will be separate rows in the report.
(::Google::Analytics::Data::V1beta::CohortsRange) — Cohort reports follow cohorts over an extended reporting date range. This
range specifies an offset duration to follow the cohorts over.
value (::Google::Analytics::Data::V1beta::CohortsRange) — Cohort reports follow cohorts over an extended reporting date range. This
range specifies an offset duration to follow the cohorts over.
Returns
(::Google::Analytics::Data::V1beta::CohortsRange) — Cohort reports follow cohorts over an extended reporting date range. This
range specifies an offset duration to follow the cohorts over.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[],[],null,["# Google Analytics Data V1beta API - Class Google::Analytics::Data::V1beta::CohortSpec (v0.4.3)\n\nVersion latestkeyboard_arrow_down\n\n- [0.4.3 (latest)](/ruby/docs/reference/google-analytics-data-v1beta/latest/Google-Analytics-Data-V1beta-CohortSpec)\n- [0.4.2](/ruby/docs/reference/google-analytics-data-v1beta/0.4.2/Google-Analytics-Data-V1beta-CohortSpec) \nReference documentation and code samples for the Google Analytics Data V1beta API class Google::Analytics::Data::V1beta::CohortSpec.\n\nThe specification of cohorts for a cohort report.\n\n\nCohort reports create a time series of user retention for the cohort. For\nexample, you could select the cohort of users that were acquired in the first\nweek of September and follow that cohort for the next six weeks. Selecting\nthe users acquired in the first week of September cohort is specified in the\n`cohort` object. Following that cohort for the next six weeks is specified in\nthe `cohortsRange` object.\n\nFor examples, see [Cohort Report\nExamples](https://developers.google.com/analytics/devguides/reporting/data/v1/advanced#cohort_report_examples).\n\n\u003cbr /\u003e\n\nThe report response could show a weekly time series where say your app has\nretained 60% of this cohort after three weeks and 25% of this cohort after\nsix weeks. These two percentages can be calculated by the metric\n`cohortActiveUsers/cohortTotalUsers` and will be separate rows in the report. \n\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #cohort_report_settings\n\n def cohort_report_settings() -\u003e ::Google::Analytics::Data::V1beta::CohortReportSettings\n\n**Returns**\n\n- ([::Google::Analytics::Data::V1beta::CohortReportSettings](./Google-Analytics-Data-V1beta-CohortReportSettings)) --- Optional settings for a cohort report.\n\n### #cohort_report_settings=\n\n def cohort_report_settings=(value) -\u003e ::Google::Analytics::Data::V1beta::CohortReportSettings\n\n**Parameter**\n\n- **value** ([::Google::Analytics::Data::V1beta::CohortReportSettings](./Google-Analytics-Data-V1beta-CohortReportSettings)) --- Optional settings for a cohort report. \n**Returns**\n\n- ([::Google::Analytics::Data::V1beta::CohortReportSettings](./Google-Analytics-Data-V1beta-CohortReportSettings)) --- Optional settings for a cohort report.\n\n### #cohorts\n\n def cohorts() -\u003e ::Array\u003c::Google::Analytics::Data::V1beta::Cohort\u003e\n\n**Returns**\n\n- (::Array\\\u003c[::Google::Analytics::Data::V1beta::Cohort](./Google-Analytics-Data-V1beta-Cohort)\\\u003e) --- Defines the selection criteria to group users into cohorts.\n\n\n Most cohort reports define only a single cohort. If multiple cohorts are\n specified, each cohort can be recognized in the report by their name.\n\n### #cohorts=\n\n def cohorts=(value) -\u003e ::Array\u003c::Google::Analytics::Data::V1beta::Cohort\u003e\n\n**Parameter**\n\n- **value** (::Array\\\u003c[::Google::Analytics::Data::V1beta::Cohort](./Google-Analytics-Data-V1beta-Cohort)\\\u003e) --- Defines the selection criteria to group users into cohorts.\n\n\n Most cohort reports define only a single cohort. If multiple cohorts are\nspecified, each cohort can be recognized in the report by their name. \n**Returns**\n\n- (::Array\\\u003c[::Google::Analytics::Data::V1beta::Cohort](./Google-Analytics-Data-V1beta-Cohort)\\\u003e) --- Defines the selection criteria to group users into cohorts.\n\n\n Most cohort reports define only a single cohort. If multiple cohorts are\n specified, each cohort can be recognized in the report by their name.\n\n### #cohorts_range\n\n def cohorts_range() -\u003e ::Google::Analytics::Data::V1beta::CohortsRange\n\n**Returns**\n\n- ([::Google::Analytics::Data::V1beta::CohortsRange](./Google-Analytics-Data-V1beta-CohortsRange)) --- Cohort reports follow cohorts over an extended reporting date range. This range specifies an offset duration to follow the cohorts over.\n\n### #cohorts_range=\n\n def cohorts_range=(value) -\u003e ::Google::Analytics::Data::V1beta::CohortsRange\n\n**Parameter**\n\n- **value** ([::Google::Analytics::Data::V1beta::CohortsRange](./Google-Analytics-Data-V1beta-CohortsRange)) --- Cohort reports follow cohorts over an extended reporting date range. This range specifies an offset duration to follow the cohorts over. \n**Returns**\n\n- ([::Google::Analytics::Data::V1beta::CohortsRange](./Google-Analytics-Data-V1beta-CohortsRange)) --- Cohort reports follow cohorts over an extended reporting date range. This range specifies an offset duration to follow the cohorts over."]]