# Google Analytics Data V1beta API - Class Google::Analytics::Data::V1beta::CohortSpec (v0.4.3)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [0.4.3 (latest)](https://docs.cloud.google.com/ruby/docs/reference/google-analytics-data-v1beta/latest/Google-Analytics-Data-V1beta-CohortSpec)
- [0.4.2](https://docs.cloud.google.com/ruby/docs/reference/google-analytics-data-v1beta/0.4.2/Google-Analytics-Data-V1beta-CohortSpec)
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.

For examples, see [Cohort Report
Examples](https://developers.google.com/analytics/devguides/reporting/data/v1/advanced#cohort_report_examples).

<br />

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.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #cohort_report_settings

    def cohort_report_settings() -> ::Google::Analytics::Data::V1beta::CohortReportSettings

**Returns**

- ([::Google::Analytics::Data::V1beta::CohortReportSettings](https://docs.cloud.google.com/ruby/docs/reference/google-analytics-data-v1beta/latest/Google-Analytics-Data-V1beta-CohortReportSettings)) --- Optional settings for a cohort report.

### #cohort_report_settings=

    def cohort_report_settings=(value) -> ::Google::Analytics::Data::V1beta::CohortReportSettings

**Parameter**

- **value** ([::Google::Analytics::Data::V1beta::CohortReportSettings](https://docs.cloud.google.com/ruby/docs/reference/google-analytics-data-v1beta/latest/Google-Analytics-Data-V1beta-CohortReportSettings)) --- Optional settings for a cohort report.
**Returns**

- ([::Google::Analytics::Data::V1beta::CohortReportSettings](https://docs.cloud.google.com/ruby/docs/reference/google-analytics-data-v1beta/latest/Google-Analytics-Data-V1beta-CohortReportSettings)) --- Optional settings for a cohort report.

### #cohorts

    def cohorts() -> ::Array<::Google::Analytics::Data::V1beta::Cohort>

**Returns**

- (::Array\<[::Google::Analytics::Data::V1beta::Cohort](https://docs.cloud.google.com/ruby/docs/reference/google-analytics-data-v1beta/latest/Google-Analytics-Data-V1beta-Cohort)\>) --- Defines the selection criteria to group users into cohorts.


  Most cohort reports define only a single cohort. If multiple cohorts are
  specified, each cohort can be recognized in the report by their name.

### #cohorts=

    def cohorts=(value) -> ::Array<::Google::Analytics::Data::V1beta::Cohort>

**Parameter**

- **value** (::Array\<[::Google::Analytics::Data::V1beta::Cohort](https://docs.cloud.google.com/ruby/docs/reference/google-analytics-data-v1beta/latest/Google-Analytics-Data-V1beta-Cohort)\>) --- Defines the selection criteria to group users into cohorts.


  Most cohort reports define only a single cohort. If multiple cohorts are
  specified, each cohort can be recognized in the report by their name.
**Returns**

- (::Array\<[::Google::Analytics::Data::V1beta::Cohort](https://docs.cloud.google.com/ruby/docs/reference/google-analytics-data-v1beta/latest/Google-Analytics-Data-V1beta-Cohort)\>) --- Defines the selection criteria to group users into cohorts.


  Most cohort reports define only a single cohort. If multiple cohorts are
  specified, each cohort can be recognized in the report by their name.

### #cohorts_range

    def cohorts_range() -> ::Google::Analytics::Data::V1beta::CohortsRange

**Returns**

- ([::Google::Analytics::Data::V1beta::CohortsRange](https://docs.cloud.google.com/ruby/docs/reference/google-analytics-data-v1beta/latest/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.

### #cohorts_range=

    def cohorts_range=(value) -> ::Google::Analytics::Data::V1beta::CohortsRange

**Parameter**

- **value** ([::Google::Analytics::Data::V1beta::CohortsRange](https://docs.cloud.google.com/ruby/docs/reference/google-analytics-data-v1beta/latest/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](https://docs.cloud.google.com/ruby/docs/reference/google-analytics-data-v1beta/latest/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.