GamebeastDocs
Dashboard
JavaScript SDKAPI Reference

Cohorts

This API is used to check whether the current user is in a cohort, in the browser.

For more information about Cohorts, visit the User Cohorts Guide.

const gamebeastCohorts = gamebeast.cohorts;

Membership is recomputed by the backend, so treat it as eventually consistent rather than real-time. Results are cached for a minute, and the endpoint is limited to 60 requests per minute per API key, so the SDK shares requests where it can.

isMember(cohortName)

Promise<boolean>return type

Checks whether the current user is in the named cohort. Resolves false when the cohort doesn't exist or the check fails (both are logged). It never rejects. Concurrent checks for the same cohort share one request.

cohortNamestring

The name of the cohort.

Usage

if (await gamebeastCohorts.isMember("High Spenders")) {
  showVipOffer();
}

On this page