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

# Online Experiments & A/B Tests

> Learn how to A-B test anything online with HoneyHive

The complete schema flexibility of HoneyHive allows you to run online experiments on any part of your system and analyze the results in HoneyHive.

You can do this by filtering data for your specific feature flag and segmenting your data by config properties like `version` to analyze how different prompt or model versions perform.

### How to run online experiments

**Preqrequisites**:

* You have already set up HoneyHive in your code as [described here](/introduction/quickstart).

**Expected Time**: 5-10 minutes

<Steps>
  <Step title="Set a metadata field to track the online experiment">
    Set a metadata field to track the experiment ID.

    Feel free to use the `experiment_id` from any pre-existing experimentation tool you are using (eg: Statsig or Launchdarkly).

    <CodeGroup>
      ```python Python theme={null}
      HoneyHiveTracer.set_metadata({
        "prompt-experiment-id": 12345,
      })
      ```

      ```typescript TypeScript theme={null}
      tracer.setMetadata({
        "prompt-experiment-id": 12345,
      })
      ```
    </CodeGroup>
  </Step>

  <Step title="Configure user feedback on the trace">
    Configure user feedback on the trace to track the experiment results.

    <CodeGroup>
      ```python Python theme={null}
      HoneyHiveTracer.set_feedback({
        "liked": True,
      })
      ```

      ```typescript TypeScript theme={null}
      tracer.setFeedback({
        "liked": true,
      })
      ```
    </CodeGroup>
  </Step>

  <Step title="Analyze the results">
    Analyze the results of the experiment using the HoneyHive dashboard.

    You can

    * Pick the `Session` or `Event` view depending on the level of granularity you need.
    * Filter by the `prompt-experiment-id` metadata field to only look at the data from the experiment.
    * Chart the `liked` field with whichever aggregation function you are interested in measuring
    * Group by the `config.version` field to see the results across your control and treatment groups.
  </Step>
</Steps>

### Learn more

<CardGroup cols={1}>
  <Card title="Grouping charts by metadata" icon="rectangle-terminal" href="/monitoring/charts">
    Learn how to group charts by metadata in HoneyHive
  </Card>
</CardGroup>
