Reference documentation and code samples for the Google Analytics Data V1beta Client class Cohort.
Defines a cohort selection criteria. A cohort is a group of users who share
a common characteristic. For example, users with the samefirstSessionDatebelong to the same cohort.
Generated from protobuf messagegoogle.analytics.data.v1beta.Cohort
Namespace
Google \ Analytics \ Data \ V1beta
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ name
string
Assigns a name to this cohort. The dimensioncohortis valued to this name in a report response. If set, cannot begin withcohort_orRESERVED_. If not set, cohorts are named by their zero based indexcohort_0,cohort_1, etc.
↳ dimension
string
Dimension used by the cohort. Required and only supportsfirstSessionDate.
The cohort selects users whose first touch date is between start date and end date defined in thedateRange. ThisdateRangedoes not specify the full date range of event data that is present in a cohort report. In a cohort report, thisdateRangeis extended by the granularity and offset present in thecohortsRange; event data for the extended reporting date range is present in a cohort report. In a cohort request, thisdateRangeis required and thedateRangesin theRunReportRequestorRunPivotReportRequestmust be unspecified. ThisdateRangeshould generally be aligned with the cohort's granularity. IfCohortsRangeuses daily granularity, thisdateRangecan be a single day. IfCohortsRangeuses weekly granularity, thisdateRangecan be aligned to a week boundary, starting at Sunday and ending Saturday. IfCohortsRangeuses monthly granularity, thisdateRangecan be aligned to a month, starting at the first and ending on the last day of the month.
getName
Assigns a name to this cohort. The dimensioncohortis valued to this
name in a report response. If set, cannot begin withcohort_orRESERVED_. If not set, cohorts are named by their zero based indexcohort_0,cohort_1, etc.
Returns
Type
Description
string
setName
Assigns a name to this cohort. The dimensioncohortis valued to this
name in a report response. If set, cannot begin withcohort_orRESERVED_. If not set, cohorts are named by their zero based indexcohort_0,cohort_1, etc.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getDimension
Dimension used by the cohort. Required and only supportsfirstSessionDate.
Returns
Type
Description
string
setDimension
Dimension used by the cohort. Required and only supportsfirstSessionDate.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getDateRange
The cohort selects users whose first touch date is between start date and
end date defined in thedateRange. ThisdateRangedoes not specify the
full date range of event data that is present in a cohort report. In a
cohort report, thisdateRangeis extended by the granularity and offset
present in thecohortsRange; event data for the extended reporting date
range is present in a cohort report.
In a cohort request, thisdateRangeis required and thedateRangesin
theRunReportRequestorRunPivotReportRequestmust be unspecified.
ThisdateRangeshould generally be aligned with the cohort's granularity.
IfCohortsRangeuses daily granularity, thisdateRangecan be a single
day. IfCohortsRangeuses weekly granularity, thisdateRangecan be
aligned to a week boundary, starting at Sunday and ending Saturday. IfCohortsRangeuses monthly granularity, thisdateRangecan be aligned to
a month, starting at the first and ending on the last day of the month.
The cohort selects users whose first touch date is between start date and
end date defined in thedateRange. ThisdateRangedoes not specify the
full date range of event data that is present in a cohort report. In a
cohort report, thisdateRangeis extended by the granularity and offset
present in thecohortsRange; event data for the extended reporting date
range is present in a cohort report.
In a cohort request, thisdateRangeis required and thedateRangesin
theRunReportRequestorRunPivotReportRequestmust be unspecified.
ThisdateRangeshould generally be aligned with the cohort's granularity.
IfCohortsRangeuses daily granularity, thisdateRangecan be a single
day. IfCohortsRangeuses weekly granularity, thisdateRangecan be
aligned to a week boundary, starting at Sunday and ending Saturday. IfCohortsRangeuses monthly granularity, thisdateRangecan be aligned to
a month, starting at the first and ending on the last day of the month.
[[["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-04 UTC."],[],[],null,["# Google Analytics Data V1beta Client - Class Cohort (0.22.3)\n\nVersion latestkeyboard_arrow_down\n\n- [0.22.3 (latest)](/php/docs/reference/analytics-data/latest/V1beta.Cohort)\n- [0.22.2](/php/docs/reference/analytics-data/0.22.2/V1beta.Cohort)\n- [0.21.1](/php/docs/reference/analytics-data/0.21.1/V1beta.Cohort)\n- [0.20.1](/php/docs/reference/analytics-data/0.20.1/V1beta.Cohort)\n- [0.19.0](/php/docs/reference/analytics-data/0.19.0/V1beta.Cohort)\n- [0.18.0](/php/docs/reference/analytics-data/0.18.0/V1beta.Cohort)\n- [0.17.1](/php/docs/reference/analytics-data/0.17.1/V1beta.Cohort)\n- [0.16.4](/php/docs/reference/analytics-data/0.16.4/V1beta.Cohort)\n- [0.14.0](/php/docs/reference/analytics-data/0.14.0/V1beta.Cohort)\n- [0.13.0](/php/docs/reference/analytics-data/0.13.0/V1beta.Cohort)\n- [0.12.0](/php/docs/reference/analytics-data/0.12.0/V1beta.Cohort)\n- [0.11.2](/php/docs/reference/analytics-data/0.11.2/V1beta.Cohort)\n- [0.10.1](/php/docs/reference/analytics-data/0.10.1/V1beta.Cohort)\n- [0.9.5](/php/docs/reference/analytics-data/0.9.5/V1beta.Cohort) \n| **Beta**\n|\n|\n| This library is covered by the [Pre-GA Offerings Terms](/terms/service-terms#1)\n| of the Terms of Service. Pre-GA libraries might have limited support,\n| and changes to pre-GA libraries might not be compatible with other pre-GA versions.\n| For more information, see the\n[launch stage descriptions](/products#product-launch-stages). \nReference documentation and code samples for the Google Analytics Data V1beta Client class 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\nGenerated from protobuf message `google.analytics.data.v1beta.Cohort`\n\nNamespace\n---------\n\nGoogle \\\\ Analytics \\\\ Data \\\\ V1beta\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getName\n\nAssigns a name to this cohort. The dimension `cohort` is valued to this\nname in a report response. If set, cannot begin with `cohort_` or\n`RESERVED_`. If not set, cohorts are named by their zero based index\n`cohort_0`, `cohort_1`, etc.\n\n### setName\n\nAssigns a name to this cohort. The dimension `cohort` is valued to this\nname in a report response. If set, cannot begin with `cohort_` or\n`RESERVED_`. If not set, cohorts are named by their zero based index\n`cohort_0`, `cohort_1`, etc.\n\n### getDimension\n\nDimension used by the cohort. Required and only supports\n`firstSessionDate`.\n\n### setDimension\n\nDimension used by the cohort. Required and only supports\n`firstSessionDate`.\n\n### getDateRange\n\nThe cohort selects users whose first touch date is between start date and\nend date defined in the `dateRange`. This `dateRange` does not specify the\nfull date range of event data that is present in a cohort report. In a\ncohort report, this `dateRange` is extended by the granularity and offset\npresent in the `cohortsRange`; event data for the extended reporting date\nrange is present in a cohort report.\n\nIn a cohort request, this `dateRange` is required and the `dateRanges` in\nthe `RunReportRequest` or `RunPivotReportRequest` must be unspecified.\nThis `dateRange` should generally be aligned with the cohort's granularity.\nIf `CohortsRange` uses daily granularity, this `dateRange` can be a single\nday. If `CohortsRange` uses weekly granularity, this `dateRange` can be\naligned 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\n### hasDateRange\n\n### clearDateRange\n\n### setDateRange\n\nThe cohort selects users whose first touch date is between start date and\nend date defined in the `dateRange`. This `dateRange` does not specify the\nfull date range of event data that is present in a cohort report. In a\ncohort report, this `dateRange` is extended by the granularity and offset\npresent in the `cohortsRange`; event data for the extended reporting date\nrange is present in a cohort report.\n\nIn a cohort request, this `dateRange` is required and the `dateRanges` in\nthe `RunReportRequest` or `RunPivotReportRequest` must be unspecified.\nThis `dateRange` should generally be aligned with the cohort's granularity.\nIf `CohortsRange` uses daily granularity, this `dateRange` can be a single\nday. If `CohortsRange` uses weekly granularity, this `dateRange` can be\naligned 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."]]