On this page

Cohort Targeting

A cohort is a static or dynamic set of users defined in Amplitude. For experiment use cases, cohorts are useful for advanced audience targeting. Cohorts aren't always the best solution for targeting, so it's important to understand how cohort targeting works with local or remote evaluation.

Experiment cohort targeting only supports targeting user cohorts.

Remote evaluation

When you target a cohort in a remote evaluation flag, Amplitude syncs the cohort to the Amplitude Experiment destination. For dynamic cohorts, this sync runs hourly by default. Dynamic cohorts targeted in remote evaluation don't update in real time. For example, if you target a cohort of users who performed a Sign Up event, Amplitude targets those users within an hour of the event.

Cohorts targeted for remote evaluation can have a propagation delay on the initial sync or after a large change, depending on the size of the difference. For example, the first sync of a 10-million-user cohort takes longer than later syncs.

Remote evaluation supports cohorts up to 10 million users.

Remote evaluation cohort targeting use cases

  • You're targeting users based on user behavior or properties that aren't available in Experiment targeting segments.
  • The targeting delay from cohort sync intervals doesn't interrupt your process.

Don't use remote evaluation cohort targeting if:

  • You need to target users in real time.

Local evaluation

Local evaluation flags and experiments deployed to up-to-date server-side SDKs can also target cohorts. When you target a cohort in a local evaluation flag, Amplitude syncs the cohort to the Experiment Local Evaluation destination. For dynamic cohorts, this sync runs hourly. Dynamic cohorts targeted in local evaluation don't update in real time. For example, if you target a cohort of users who performed a Sign Up event, Amplitude targets those users within an hour of the event, not immediately after.

Local evaluation supports cohorts up to 50 million users.

Cohorts only support User IDs

Local evaluation cohorts only sync user IDs to the SDKs. To target cohorts in local evaluation flags, include a user ID in the user object passed to the evaluate function.

SDK support

Server-side SDKs can target cohorts when you configure them to do so. Client-side SDKs don't support local evaluation cohort targeting.

On initialization, configure the cohort sync configuration with the project API and secret key to enable local evaluation cohort downloading and targeting.

js
const experiment = Experiment.initializeLocal('DEPLOYMENT_KEY', {
  // (Recommended) Enable local evaluation cohort targeting.
  cohortSyncConfig: {
    apiKey: 'API_KEY',
    secretKey: 'SECRET_KEY'
  }
});

Troubleshooting

Cohort targeting can be challenging to troubleshoot because dynamic cohorts and cohort syncs are asynchronous. If your experiment isn't targeting users who should be in the targeted cohort, try the following:

  • For local evaluation, check that the SDK version supports local evaluation cohort targeting, and that you set the cohort sync config on initialization.
  • Check that the cohort has the required sync (Amplitude Experiment for remote evaluation, Experiment Local Evaluation for local evaluation).
  • Check that the cohort contains the expected user. If the user is in the current cohort, check the sync history of the cohort. The user may have been added to the cohort in a sync after the evaluation occurred.
  • Check that the user info passed to fetch or evaluate is correct.

Was this helpful?