> ## Documentation Index
> Fetch the complete documentation index at: https://confidence.spotify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Define the Audience

> Learn how to add inclusion criteria to target specific users in rules and segments.

export const HowToSchema = ({name, description, steps = []}) => {
  const schema = {
    "@context": "https://schema.org",
    "@type": "HowTo",
    name,
    description
  };
  if (steps.length > 0) {
    schema.step = steps.map((s, i) => ({
      "@type": "HowToStep",
      position: i + 1,
      name: typeof s === "string" ? s : s.name,
      text: typeof s === "string" ? s : s.text || s.name
    }));
  }
  return <script type="application/ld+json" dangerouslySetInnerHTML={{
    __html: JSON.stringify(schema)
  }} />;
};

<HowToSchema
  name="Define the Audience"
  description="Learn how to add inclusion criteria to target specific users in rules and segments."
  steps={[
{
  name: "Go to where you want to add the criterion in Confidence",
  text: "This can be in an already created A/B test, rollout, segment, or rule.",
},
{
  name: "Click + Add attribute",
  text: "Click + Add attribute in the Inclusion criteria section.",
},
"Type in the name of the criterion, and select its type",
{
  name: "Select the appropriate operator",
  text: "Click it to unfold the dropdown list.",
},
{
  name: "Go to where you want to add the criterion in Confidence",
  text: "This can be in an already created A/B test, rollout, segment, or rule.",
},
{
  name: "Click + Add segment",
  text: "Click + Add segment in the Inclusion criteria section.",
},
{
  name: "Select the segment",
  text: "Choose a segment from the dropdown list.",
},
{
  name: "Go to where you want to add the criterion in Confidence",
  text: "This can be in an already created A/B test, rollout, segment, or rule.",
},
{
  name: "Click + Add holdback",
  text: "Click + Add holdback in the Inclusion criteria section.",
},
{
  name: "Select a holdback",
  text: "Choose a holdback from the dropdown list. Only holdbacks from surfaces associated with your experiment are available.",
},
{
  name: "Go to where you want to add the criterion in Confidence",
  text: "This can be in an already created A/B test, rollout, segment, or rule.",
},
{
  name: "Click + Add group",
  text: "Click + Add group in the Inclusion criteria section.",
},
{
  name: "Select the logical operator",
  text: "Choose AND or OR to control how criteria within the group combine.",
},
{
  name: "Add criteria to the group",
  text: "Add attributes, segments, or holdbacks within the group.",
},
]}
/>

The [audience](../flags/audience) is the set of users or other units that are eligible for a rule or segment.

The **Inclusion criteria** section offers four ways to define your audience:

* **Add attribute**: Target users based on evaluation context fields like country, platform, or version.
* **Add segment**: Target users who belong to a pre-defined [segment](../flags/segments).
* **Add holdback**: Include or exclude a random subset of users defined by a [holdback](../surfaces/surface-settings#holdbacks) on a surface.
* **Add group**: Combine multiple criteria into a logical group with `AND` or `OR` operators.

## Add an Attribute Criterion

<Steps>
  <Step title="Go to where you want to add the criterion in Confidence">
    This can be in an already created A/B test, rollout, segment, or rule.
  </Step>

  <Step title="Click + Add attribute">
    Click **+ Add attribute** in the **Inclusion criteria** section.
  </Step>

  <Step title="Type in the name of the criterion, and select its type" />

  <Step title="Select the appropriate operator">
    Click it to unfold the dropdown list.
  </Step>
</Steps>

If Confidence has seen the field before, it autocompletes and the
type populates automatically. The operators available to choose from is
dependent on the type of the field. For example, if the field is a string, the
operator is one of: `is` (equals), `is not` (not equals), `in` (one of many) or
`not in` (not one of many).

<Note>
  The `in` operator behaves differently depending on how the context value is typed:

  * **String**: `in` checks whether the entire string equals one of the listed values. It does **not** do substring matching. For example, if `fruit` is the string `"Apple, Banana, Cherry"`, then `fruit in ["Banana"]` will **not** match, because the full string does not equal `"Banana"`.
  * **List of strings**: `in` checks whether any element in the list matches one of the listed values. If `fruit` is the list `["Apple", "Banana", "Cherry"]`, then `fruit in ["Banana"]` **will** match.

  If you need to target users based on a comma-separated string, consider changing the context field to send a list of strings instead. Confidence does not support substring matching on strings.
</Note>

## Add a Segment Criterion

Use a segment criterion to target users who belong to a pre-defined [segment](../flags/segments).
This lets you reuse the same audience definition across multiple experiments, rollouts, and rules.

<Steps>
  <Step title="Go to where you want to add the criterion in Confidence">
    This can be in an already created A/B test, rollout, segment, or rule.
  </Step>

  <Step title="Click + Add segment">
    Click **+ Add segment** in the **Inclusion criteria** section.
  </Step>

  <Step title="Select the segment">
    Choose a segment from the dropdown list.
  </Step>
</Steps>

<Tip>
  Create segments in the **Segments** section of the left sidebar. Learn more in the [Create Segments](./create-segments) guide.
</Tip>

## Add a Holdback Criterion

Use a holdback criterion to include or exclude a random subset of users defined by a [holdback](../surfaces/surface-settings#holdbacks).
Holdbacks are configured on [surfaces](../surfaces/introduction) and represent a stable random subset of users that you can reuse over time.

<Steps>
  <Step title="Go to where you want to add the criterion in Confidence">
    This can be in an already created A/B test, rollout, segment, or rule.
  </Step>

  <Step title="Click + Add holdback">
    Click **+ Add holdback** in the **Inclusion criteria** section.
  </Step>

  <Step title="Select a holdback">
    Choose a holdback from the dropdown list. Only holdbacks from surfaces associated with your experiment are available.
  </Step>
</Steps>

<Note>
  Holdbacks are defined on surfaces. To create a new holdback, go to the surface's settings page. Learn more about holdbacks in the [surface settings documentation](../surfaces/surface-settings#holdbacks).
</Note>

## Add a Group

Use groups to combine multiple criteria with `AND` or `OR` operators.
Groups let you build complex targeting logic beyond individual attribute criteria.

<Steps>
  <Step title="Go to where you want to add the criterion in Confidence">
    This can be in an already created A/B test, rollout, segment, or rule.
  </Step>

  <Step title="Click + Add group">
    Click **+ Add group** in the **Inclusion criteria** section.
  </Step>

  <Step title="Select the logical operator">
    Choose `AND` or `OR` to control how criteria within the group combine.
  </Step>

  <Step title="Add criteria to the group">
    Add attributes, segments, or holdbacks within the group.
  </Step>
</Steps>

You can nest groups to create arbitrarily complex targeting logic.
For example, you can target users in Sweden `AND` (on iOS `OR` Android).

## Related Resources

<CardGroup cols={2}>
  <Card title="Audience Reference" href="/docs/flags/audience">
    Deep dive into targeting and allocation
  </Card>

  <Card title="Create Segments" href="/docs/how-to-guides/create-segments">
    Define reusable user groups
  </Card>

  <Card title="Context Schema" href="/docs/flags/context-schema">
    Configure available targeting attributes
  </Card>

  <Card title="Surface Settings" href="/docs/surfaces/surface-settings">
    Configure holdbacks and exclusivity groups
  </Card>

  <Card title="Target with Criteria API" href="/docs/api/how-to-guides/flags/target-with-criteria">
    API reference for targeting
  </Card>
</CardGroup>
