Reference documentation and code samples for the Google Analytics Data V1beta API class Google::Analytics::Data::V1beta::Cohort.
Defines a cohort selection criteria. A cohort is a group of users who share
a common characteristic. For example, users with the same firstSessionDate
belong to the same cohort.
(::Google::Analytics::Data::V1beta::DateRange) — The cohort selects users whose first touch date is between start date and
end date defined in the dateRange. This dateRange does not specify the
full date range of event data that is present in a cohort report. In a
cohort report, this dateRange is extended by the granularity and offset
present in the cohortsRange; event data for the extended reporting date
range is present in a cohort report.
In a cohort request, this dateRange is required and the dateRanges in
the RunReportRequest or RunPivotReportRequest must be unspecified.
This dateRange should generally be aligned with the cohort's granularity.
If CohortsRange uses daily granularity, this dateRange can be a single
day. If CohortsRange uses weekly granularity, this dateRange can be
aligned to a week boundary, starting at Sunday and ending Saturday. If
CohortsRange uses monthly granularity, this dateRange can be aligned to
a month, starting at the first and ending on the last day of the month.
value (::Google::Analytics::Data::V1beta::DateRange) — The cohort selects users whose first touch date is between start date and
end date defined in the dateRange. This dateRange does not specify the
full date range of event data that is present in a cohort report. In a
cohort report, this dateRange is extended by the granularity and offset
present in the cohortsRange; event data for the extended reporting date
range is present in a cohort report.
In a cohort request, this dateRange is required and the dateRanges in
the RunReportRequest or RunPivotReportRequest must be unspecified.
This dateRange should generally be aligned with the cohort's granularity.
If CohortsRange uses daily granularity, this dateRange can be a single
day. If CohortsRange uses weekly granularity, this dateRange can be
aligned to a week boundary, starting at Sunday and ending Saturday. If
CohortsRange uses monthly granularity, this dateRange can be aligned to
a month, starting at the first and ending on the last day of the month.
Returns
(::Google::Analytics::Data::V1beta::DateRange) — The cohort selects users whose first touch date is between start date and
end date defined in the dateRange. This dateRange does not specify the
full date range of event data that is present in a cohort report. In a
cohort report, this dateRange is extended by the granularity and offset
present in the cohortsRange; event data for the extended reporting date
range is present in a cohort report.
In a cohort request, this dateRange is required and the dateRanges in
the RunReportRequest or RunPivotReportRequest must be unspecified.
This dateRange should generally be aligned with the cohort's granularity.
If CohortsRange uses daily granularity, this dateRange can be a single
day. If CohortsRange uses weekly granularity, this dateRange can be
aligned to a week boundary, starting at Sunday and ending Saturday. If
CohortsRange uses monthly granularity, this dateRange can be aligned to
a month, starting at the first and ending on the last day of the month.
#dimension
defdimension()->::String
Returns
(::String) — Dimension used by the cohort. Required and only supports
firstSessionDate.
#dimension=
defdimension=(value)->::String
Parameter
value (::String) — Dimension used by the cohort. Required and only supports
firstSessionDate.
Returns
(::String) — Dimension used by the cohort. Required and only supports
firstSessionDate.
#name
defname()->::String
Returns
(::String) — Assigns a name to this cohort. The dimension cohort is valued to this
name in a report response. If set, cannot begin with cohort_ or
RESERVED_. If not set, cohorts are named by their zero based index
cohort_0, cohort_1, etc.
#name=
defname=(value)->::String
Parameter
value (::String) — Assigns a name to this cohort. The dimension cohort is valued to this
name in a report response. If set, cannot begin with cohort_ or
RESERVED_. If not set, cohorts are named by their zero based index
cohort_0, cohort_1, etc.
Returns
(::String) — Assigns a name to this cohort. The dimension cohort is valued to this
name in a report response. If set, cannot begin with cohort_ or
RESERVED_. If not set, cohorts are named by their zero based index
cohort_0, cohort_1, etc.
[[["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::Cohort (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-Cohort)\n- [0.4.2](/ruby/docs/reference/google-analytics-data-v1beta/0.4.2/Google-Analytics-Data-V1beta-Cohort) \nReference documentation and code samples for the Google Analytics Data V1beta API class Google::Analytics::Data::V1beta::Cohort.\n\nDefines a cohort selection criteria. A cohort is a group of users who share\na common characteristic. For example, users with the same `firstSessionDate`\nbelong to the same cohort. \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### #date_range\n\n def date_range() -\u003e ::Google::Analytics::Data::V1beta::DateRange\n\n**Returns**\n\n- ([::Google::Analytics::Data::V1beta::DateRange](./Google-Analytics-Data-V1beta-DateRange)) --- The cohort selects users whose first touch date is between start date and end date defined in the `dateRange`. This `dateRange` does not specify the full date range of event data that is present in a cohort report. In a cohort report, this `dateRange` is extended by the granularity and offset present in the `cohortsRange`; event data for the extended reporting date range is present in a cohort report.\n\n\n In a cohort request, this `dateRange` is required and the `dateRanges` in\n the `RunReportRequest` or `RunPivotReportRequest` must be unspecified.\n\n This `dateRange` should generally be aligned with the cohort's granularity.\n If `CohortsRange` uses daily granularity, this `dateRange` can be a single\n day. If `CohortsRange` uses weekly granularity, this `dateRange` can be\n aligned to a week boundary, starting at Sunday and ending Saturday. If\n `CohortsRange` uses monthly granularity, this `dateRange` can be aligned to\n a month, starting at the first and ending on the last day of the month.\n\n### #date_range=\n\n def date_range=(value) -\u003e ::Google::Analytics::Data::V1beta::DateRange\n\n**Parameter**\n\n- **value** ([::Google::Analytics::Data::V1beta::DateRange](./Google-Analytics-Data-V1beta-DateRange)) --- The cohort selects users whose first touch date is between start date and end date defined in the `dateRange`. This `dateRange` does not specify the full date range of event data that is present in a cohort report. In a cohort report, this `dateRange` is extended by the granularity and offset present in the `cohortsRange`; event data for the extended reporting date range is present in a cohort report.\n\n\n In a cohort request, this `dateRange` is required and the `dateRanges` in\n the `RunReportRequest` or `RunPivotReportRequest` must be unspecified.\n\n This `dateRange` should generally be aligned with the cohort's granularity.\n If `CohortsRange` uses daily granularity, this `dateRange` can be a single\n day. If `CohortsRange` uses weekly granularity, this `dateRange` can be\n aligned to a week boundary, starting at Sunday and ending Saturday. If\n `CohortsRange` uses monthly granularity, this `dateRange` can be aligned to\na month, starting at the first and ending on the last day of the month. \n**Returns**\n\n- ([::Google::Analytics::Data::V1beta::DateRange](./Google-Analytics-Data-V1beta-DateRange)) --- The cohort selects users whose first touch date is between start date and end date defined in the `dateRange`. This `dateRange` does not specify the full date range of event data that is present in a cohort report. In a cohort report, this `dateRange` is extended by the granularity and offset present in the `cohortsRange`; event data for the extended reporting date range is present in a cohort report.\n\n\n In a cohort request, this `dateRange` is required and the `dateRanges` in\n the `RunReportRequest` or `RunPivotReportRequest` must be unspecified.\n\n This `dateRange` should generally be aligned with the cohort's granularity.\n If `CohortsRange` uses daily granularity, this `dateRange` can be a single\n day. If `CohortsRange` uses weekly granularity, this `dateRange` can be\n aligned to a week boundary, starting at Sunday and ending Saturday. If\n `CohortsRange` uses monthly granularity, this `dateRange` can be aligned to\n a month, starting at the first and ending on the last day of the month.\n\n### #dimension\n\n def dimension() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Dimension used by the cohort. Required and only supports `firstSessionDate`.\n\n### #dimension=\n\n def dimension=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- Dimension used by the cohort. Required and only supports `firstSessionDate`. \n**Returns**\n\n- (::String) --- Dimension used by the cohort. Required and only supports `firstSessionDate`.\n\n### #name\n\n def name() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Assigns a name to this cohort. The dimension `cohort` is valued to this name in a report response. If set, cannot begin with `cohort_` or `RESERVED_`. If not set, cohorts are named by their zero based index `cohort_0`, `cohort_1`, etc.\n\n### #name=\n\n def name=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- Assigns a name to this cohort. The dimension `cohort` is valued to this name in a report response. If set, cannot begin with `cohort_` or `RESERVED_`. If not set, cohorts are named by their zero based index `cohort_0`, `cohort_1`, etc. \n**Returns**\n\n- (::String) --- Assigns a name to this cohort. The dimension `cohort` is valued to this name in a report response. If set, cannot begin with `cohort_` or `RESERVED_`. If not set, cohorts are named by their zero based index `cohort_0`, `cohort_1`, etc."]]