Skip to content

Commit 5c5d2e5

Browse files
authored
docs: Clarify cohort usage in test account filters for CDP destinations (#16234)
* docs(cohorts): add CDP destination compatibility note for cohort filters Based on PR #53333, which clarified that: - Person-property-only cohorts work in CDP destinations (inlined automatically) - Behavioral/empty cohorts cause CDP destination errors - All cohort types work fine for analytics queries * Update filter-internal-users tutorial to clarify cohort behavior in CDP destinations Reflects changes from PostHog/posthog#53333: person-property-only cohorts work in CDP destinations (inlined automatically), but behavioral cohorts or empty cohorts cause errors. Inline person property filters work everywhere. --------- Co-authored-by: inkeep[bot] <257615677+inkeep[bot]@users.noreply.github.com>
1 parent 350e728 commit 5c5d2e5

2 files changed

Lines changed: 91 additions & 81 deletions

File tree

contents/docs/data/cohorts.mdx

Lines changed: 56 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,23 @@ availability:
2121
enterprise: true
2222
---
2323

24-
import {ProductScreenshot} from 'components/ProductScreenshot'
25-
export const cohortsPageLight = "https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/features/cohorts/cohorts-page-light-mode.png"
26-
export const cohortsPageDark = "https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/features/cohorts/cohorts-page-dark-mode.png"
27-
28-
import {ProductVideo} from 'components/ProductVideo'
29-
export const createCohortLight = "https://res.cloudinary.com/dmukukwp6/video/upload/v1710055416/posthog.com/contents/images/features/cohorts/create-cohort-from-trend-light-mode.mp4"
30-
export const createCohortDark = "https://res.cloudinary.com/dmukukwp6/video/upload/v1710055416/posthog.com/contents/images/features/cohorts/create-cohort-from-trend-dark-mode.mp4"
24+
import { ProductScreenshot } from "components/ProductScreenshot";
25+
export const cohortsPageLight =
26+
"https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/features/cohorts/cohorts-page-light-mode.png";
27+
export const cohortsPageDark =
28+
"https://res.cloudinary.com/dmukukwp6/image/upload/posthog.com/contents/images/features/cohorts/cohorts-page-dark-mode.png";
29+
30+
import { ProductVideo } from "components/ProductVideo";
31+
export const createCohortLight =
32+
"https://res.cloudinary.com/dmukukwp6/video/upload/v1710055416/posthog.com/contents/images/features/cohorts/create-cohort-from-trend-light-mode.mp4";
33+
export const createCohortDark =
34+
"https://res.cloudinary.com/dmukukwp6/video/upload/v1710055416/posthog.com/contents/images/features/cohorts/create-cohort-from-trend-dark-mode.mp4";
3135

3236
## What are cohorts?
3337

3438
<iframe
35-
src="https://www.youtube-nocookie.com/embed/2jQco8hEvTI?start=375"
36-
className="rounded shadow-xl"
39+
src="https://www.youtube-nocookie.com/embed/2jQco8hEvTI?start=375"
40+
className="rounded shadow-xl"
3741
/>
3842

3943
Cohorts enable you to easily create a list of users who have something in common, such as completing an [action](/docs/data/actions) or having the same [property](/docs/product-analytics/person-properties).
@@ -48,7 +52,7 @@ Here are a few examples of the cohorts you can create:
4852

4953
Your cohorts are available in the [People](https://us.posthog.com/persons) page under the [Cohorts](https://us.posthog.com/cohorts) tab.
5054

51-
> **Note:** Cohorts rely on [person properties](/docs/product-analytics/person-properties), so you need to capture identified events to create them.
55+
> **Note:** Cohorts rely on [person properties](/docs/product-analytics/person-properties), so you need to capture identified events to create them.
5256
5357
## Where can you use cohorts?
5458

@@ -61,6 +65,9 @@ You can use cohorts in many different ways, such as:
6165
- To filter the session replay list and create playlists
6266
- Filter live events on the [activity page](/docs/activity)
6367
- Filter users on the People page
68+
- To [filter out internal and test users](/tutorials/filter-internal-users) in test account filters
69+
70+
> **Note:** Cohorts used in [CDP](/docs/cdp) destination filters must contain **exclusively person property filters**. Person-property-only cohorts are automatically inlined and work in real-time CDP destinations. Cohorts with behavioral filters or no properties defined will cause CDP destinations to error. All cohort types work for analytics queries (insights, dashboards).
6471
6572
You can use cohorts to answer questions like:
6673

@@ -75,11 +82,10 @@ Cohorts are sometimes confused with [groups](/docs/product-analytics/group-analy
7582
- **Cohorts** represent a specific set of users – e.g., a list of users whose email contains a certain string (like a company's domain).
7683

7784
- **Groups** aggregate events based on entities, such as organizations or companies, but do not necessarily connect to a user. They enable you to analyze trends, insights, and dashboards at an entity-level (like a company or organization), as opposed to a user-level.
78-
79-
If your only goal is to create a **list of users** with something in common, we recommend cohorts instead of groups.
8085

81-
Groups require additional code in your app to set up, while cohorts are created in PostHog and don't require additional code. This makes cohorts easier to use and quicker to get started.
86+
If your only goal is to create a **list of users** with something in common, we recommend cohorts instead of groups.
8287

88+
Groups require additional code in your app to set up, while cohorts are created in PostHog and don't require additional code. This makes cohorts easier to use and quicker to get started.
8389

8490
## How to create a cohort
8591

@@ -89,7 +95,7 @@ Once you've captured identified events, there are two ways to create a new cohor
8995

9096
You can create cohorts using data from insights such as trends, [funnels](/docs/product-analytics/funnels), [user paths](/docs/product-analytics/paths) and [lifecycles](/docs/product-analytics/lifecycle).
9197

92-
1. Go to [insights](https://us.posthog.com/insights) and open any insight that's aggregated at a user-level, like `unique users` or `weekly active user`.
98+
1. Go to [insights](https://us.posthog.com/insights) and open any insight that's aggregated at a user-level, like `unique users` or `weekly active user`.
9399

94100
2. Click a data point in the visualization to view the [persons](/docs/data/persons) represented in the underlying data.
95101

@@ -98,10 +104,10 @@ You can create cohorts using data from insights such as trends, [funnels](/docs/
98104
The video below shows how to create a new cohort from a trend, although you can similarly create a cohort from a funnel, user path, or any other insight.
99105

100106
<ProductVideo
101-
videoLight={createCohortLight}
102-
videoDark={createCohortDark}
103-
alt="How to create a cohort from a trend"
104-
classes="rounded"
107+
videoLight={createCohortLight}
108+
videoDark={createCohortDark}
109+
alt="How to create a cohort from a trend"
110+
classes="rounded"
105111
/>
106112

107113
### Method 2: Create a new cohort from the cohorts page
@@ -111,10 +117,10 @@ The video below shows how to create a new cohort from a trend, although you can
111117
2. Click **+ New Cohort** on the top right.
112118

113119
<ProductScreenshot
114-
imageLight={cohortsPageLight}
115-
imageDark={cohortsPageDark}
116-
alt="left hand navigation for cohorts"
117-
classes="rounded"
120+
imageLight={cohortsPageLight}
121+
imageDark={cohortsPageDark}
122+
alt="left hand navigation for cohorts"
123+
classes="rounded"
118124
/>
119125

120126
## Static and dynamic cohorts
@@ -129,7 +135,7 @@ You have two options when creating a cohort:
129135

130136
Static cohorts are created from insights, by uploading a CSV of users, or by duplicating a dynamic cohort.
131137

132-
When creating cohorts from CSVs, the [person profile](/docs/data/persons) associated with each row must already exist in PostHog.
138+
When creating cohorts from CSVs, the [person profile](/docs/data/persons) associated with each row must already exist in PostHog.
133139

134140
You can identify users using either:
135141

@@ -210,12 +216,12 @@ Dynamic cohorts can be based on existing cohorts, and support the following crit
210216

211217
#### Behavioral
212218

213-
| **Event or action** | **Example** |
214-
| --- | --- |
215-
| Completed event or action | Completed `user signed up` in the last 30 days |
216-
| Did not complete event or action | Did not complete `user signed up` in the last 2 months |
217-
| Completed event or action multiple times | Completed `watched video` 5 times in the last 2 weeks |
218-
| Completed a sequence of events or actions | Completed `user signed up` in the last 5 days followed by `watched video` within 1 day of the initial event |
219+
| **Event or action** | **Example** |
220+
| ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
221+
| Completed event or action | Completed `user signed up` in the last 30 days |
222+
| Did not complete event or action | Did not complete `user signed up` in the last 2 months |
223+
| Completed event or action multiple times | Completed `watched video` 5 times in the last 2 weeks |
224+
| Completed a sequence of events or actions | Completed `user signed up` in the last 5 days followed by `watched video` within 1 day of the initial event |
219225
| Did not complete a sequence of events or actions | Did not complete `user signed up` in the last 5 days followed by `watched video` within 1 day of the initial event |
220226

221227
You can select `days`, `weeks`, `months` or `years` time ranges here.
@@ -224,27 +230,27 @@ You can select `days`, `weeks`, `months` or `years` time ranges here.
224230

225231
Has or doesn't have a person property with the following operators:
226232

227-
| **Operator** | **Example** |
228-
| --- | --- |
229-
| `equals` or `does not equal` | `Pineapple on pizza` property `does not equal` "true" |
230-
| `contains` or `does not contain` | `email` property `does not contain` "gmail", "yahoo", "hotmail" |
231-
| `matches regex` or `does not match regex` | `Country code` property `matches regex` "us\|uk\|aus" |
232-
| `greater than` or `greater than or equal to` | `Age` property `greater than` "21" |
233-
| `less than` or `less than or equal to` | `Age` property `less than or equal to` "21" |
234-
| `is set` or `is not set` | `UTM Source` property `is not set` |
235-
| `between` or `not between` | `Age` property is between "18" and "30" |
236-
| `minimum` or `maximum` value | `Organization size` property has a `minimum` of "5" |
233+
| **Operator** | **Example** |
234+
| -------------------------------------------- | --------------------------------------------------------------- |
235+
| `equals` or `does not equal` | `Pineapple on pizza` property `does not equal` "true" |
236+
| `contains` or `does not contain` | `email` property `does not contain` "gmail", "yahoo", "hotmail" |
237+
| `matches regex` or `does not match regex` | `Country code` property `matches regex` "us\|uk\|aus" |
238+
| `greater than` or `greater than or equal to` | `Age` property `greater than` "21" |
239+
| `less than` or `less than or equal to` | `Age` property `less than or equal to` "21" |
240+
| `is set` or `is not set` | `UTM Source` property `is not set` |
241+
| `between` or `not between` | `Age` property is between "18" and "30" |
242+
| `minimum` or `maximum` value | `Organization size` property has a `minimum` of "5" |
237243

238244
For a complete list of all available operators, including semver operators for version-based filtering, see the [property filter operators reference](/docs/data/property-filters).
239245

240246
#### Lifecycle
241247

242-
| **Criteria** | **Example** |
243-
| --- | --- |
244-
| Completed an event for first time | Completed `shared insight` event for the first time in the "last 30 days" |
245-
| Completed an event regularly | Completed `shared insight` at least "3 times per week" for at least "3 of the last 5 periods" |
246-
| Stopped doing an event | Stopped doing `shared insight` event in the "last 5 days" but had done it in the "5 days prior" |
247-
| Started doing event again | Started doing `shared insight` event in the "last 5 days" but had not done it in the "5 days prior" |
248+
| **Criteria** | **Example** |
249+
| --------------------------------- | --------------------------------------------------------------------------------------------------- |
250+
| Completed an event for first time | Completed `shared insight` event for the first time in the "last 30 days" |
251+
| Completed an event regularly | Completed `shared insight` at least "3 times per week" for at least "3 of the last 5 periods" |
252+
| Stopped doing an event | Stopped doing `shared insight` event in the "last 5 days" but had done it in the "5 days prior" |
253+
| Started doing event again | Started doing `shared insight` event in the "last 5 days" but had not done it in the "5 days prior" |
248254

249255
You can select `days`, `weeks`, `months` or `years` time ranges here.
250256

@@ -257,11 +263,11 @@ Dynamic cohorts are updated once every 24 hours.
257263
### Can you use a dynamic cohort as a feature flag target?
258264

259265
You cannot use dynamic cohorts that include behavioral or lifecycle criteria as a feature flag target. To target these dynamic cohorts for a feature flag, A/B test, or survey, you must first duplicate them into a static cohort. Dynamic cohorts with only person property criteria can be used.
260-
261-
### Can you use groups in cohorts?
262-
263-
Not yet, but we are working on [rewriting cohort calculations in SQL](/teams/product-analytics#goals) which will unlock your ability to do this.
264-
266+
267+
### Can you use groups in cohorts?
268+
269+
Not yet, but we are working on [rewriting cohort calculations in SQL](/teams/product-analytics#goals) which will unlock your ability to do this.
270+
265271
### Further reading
266272

267273
- [How to track new and returning users in PostHog](/tutorials/track-new-returning-users)

0 commit comments

Comments
 (0)