How to Create & Filter by Cohorts in Autoplay

2 min read
💡
Quick steps:
  • 🛠️ Create cohorts in PostHog → Autoplay pulls them in automatically
  • 👇 Example below: new users cohort

🖲️ Creating a cohort for tracking new users

Easiest path: cohort by first-time event (pageviews, identify, or custom).

⚙️ Setup:

  1. Go to Cohort tab → click New cohort
  1. Enter a title + description
  1. Choose “completed an event for the first time” → pick event & recency

✨ Once saved → cohort auto-appears in Autoplay filters (may take a few mins).

⚠️ Note: behavioral cohorts (event-based) don’t work with feature flags.

💻 Manually set person property

If neither option fits → set a person property manually in a custom event.

💡 Example: when a user first hits your API, save their creation date as a person property — capture an event at the same time using $set_once:

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

Was this page helpful?