Below is an example for tracking a cohort of new users
Here is the original posthog article: https://posthog.com/tutorials/track-new-returning-users#completed-event-for-the-first-time-cohort
Creating a cohort for tracking new users
The first and easiest is creating a cohort where the users completed an event (such as pageviews, identify, or a custom event) for the first time. To set this up, go to the cohort tab, click new cohort, enter a title and description, then choose "completed an event for the first time" with your event and recency.
Create a dynamic cohort based on a recent signup event
1. Open People & groups to access cohort and audience management.

2. Go to the Cohorts tab to view existing segments and create a new one.

3. Click New cohort to start building a cohort from behavioral criteria.

4. Enter a clear cohort name so it’s easy to reuse in reports and targeting.

5. Open the Type dropdown to confirm this cohort will update automatically.

6. Select Dynamic to keep membership current as new signups come in.

7. Use the matching logic dropdown to control how multiple rules are combined.

8. Choose Any to include people who meet at least one criterion.

9. Revisit the Any/All setting if you need to tighten or broaden cohort membership.

10. Set the logic to Any (OR) so additional rules won’t block qualifying users.

11. Open the criterion type to define what user behavior should qualify someone.

12. Keep Completed event to build the cohort from a tracked behavioral event.

13. Click Choose event or action to pick the signup event that powers this cohort.

14. Select user_signed_up to base the cohort on recent signup activity.

15. Add a filter if you want to narrow signups by event properties (like plan or source).

16. Use the filter picker to target only the signup events that match your criteria.

17. Adjust the time window to define what counts as a recent signup.

18. Choose Last 7 days to create a cohort of the most recent signups.

19. Click Add criteria if you want to add extra rules, like geography or signup method.

20. Remove any extra rule you don’t need so the cohort stays focused on recent signups.

21. Click Save to create your dynamic cohort based on signups in the last week.

22.

Once the new cohort is saved, it will automatically appear in Autoplay’s filter options (it may take a few minutes to show up). You can then use this cohort of new users for further analysis.
Note: since this is a behavioral cohort (based on events), this cohort won’t work with feature flags.
Manually set person property
If neither of these works for you, you can set up a person property manually in a custom event.
For example, when a user first uses your API, set their creation date in their person properties. To do this, you can capture an event at the same time, and use the $set_once property like this:
Python
posthog.capture(
'phc_HVcGJdGDtkcvV1qUuz5bDrMf987gskGUpFH1nV6ufov',
event='new_user_created',
properties={ '$set_once': { 'created_at': '2023-04-24T22:02:02' } }
)
This is especially useful for projects that are on the backend, not using autocapture, or not using posthog-js, or have many custom events.
______________________________________________________________________________________________ To ensure cohorts are tracked properly, please make sure your API key’s access and scope are configured correctly. If you’re unsure how to set this up, you can follow the example steps below:
Edit a personal API key’s access and scopes
1. Open Settings from the left sidebar to manage project configuration.

2. Go to Personal API keys to view and manage your existing keys.

3. Use the more options menu on the “Zapier” key to access management actions.

4. Select Edit to change this API key’s access and permission scopes.

5. Choose “All access” to apply this key across all organizations and projects.

6. Set the Person scope to Read to allow viewing people data without making changes.

7. Set the Cohort scope to Read to allow viewing cohort data without editing it.

8. Click Save key to apply your updated access and scopes.
